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问题

相关文章:

  • 2021-11-25
  • 2021-12-08
  • 2022-02-17
  • 2021-06-26
  • 2022-12-23
  • 2021-06-28
  • 2021-11-29
猜你喜欢
  • 2021-09-13
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
  • 2021-04-04
  • 2022-12-23
相关资源
相似解决方案