Linux运行shell脚本提示:
env: can’t execute 'sh ': No such file or directory
原因:
是文件格式是 dos 格式的缘故,改成 unix 格式即可
解决:
-
用vim打开该sh文件,输入:
:set ff
回车,显示fileformat=dos -
重新设置文件格式:
:set ff=unix
-
保存退出:
:wq
总结:
shell脚本尽量在Linux下编写,迁移时会少很多问题
Linux运行shell脚本提示:
env: can’t execute 'sh ': No such file or directory
原因:
是文件格式是 dos 格式的缘故,改成 unix 格式即可
解决:
用vim打开该sh文件,输入:
:set ff
回车,显示fileformat=dos
重新设置文件格式:
:set ff=unix
保存退出:
:wq
总结:
shell脚本尽量在Linux下编写,迁移时会少很多问题