Linux -bash no such file or dirretory问题

1、一般是在Windows下用一些编辑器写好, 然后拷贝文件到linux下。(一般会出现文件格式问题)

Linux -bash no such file or dirretory问题

2、用vim a.sh进入a.sh这个文件, 然后在底部模式下, 执行:set ff查看一下, 如果发现fileformat=dos 则是文件格式问题:

Linux -bash no such file or dirretory问题

3、解决格式问题:在底部模式下, 执行:set fileformat=unix后执行:x或者:wq保存修改。 然后就可以执行./a.sh运行脚本了。

1)、set fileformat=unix 转为unix

Linux -bash no such file or dirretory问题

2)、set ff再次查看

Linux -bash no such file or dirretory问题

3)、再次运行./a.sh成功

Linux -bash no such file or dirretory问题