Linux 执行.sh文件 提示No such file or directory

Linux 执行.sh文件 提示No such file or directory

原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No such file or directory错误,那么一般是文件格式是dos格式的缘故,改成unix 格式即可

#用vim打开该sh文件,
vim xxx.sh
#输入:set ff 查看文件格式:
:set ff 
#回车,显示fileformat=dos,重新设置下文件格式:
:set ff=unix 
#保存退出: 
:wq 
posted @ 2021-10-27 09:23  RNGException  阅读(295)  评论(0编辑  收藏  举报