美文网首页
linux下执行sh脚本,提示Command not found

linux下执行sh脚本,提示Command not found

作者: J大空 | 来源:发表于2020-03-24 21:32 被阅读0次

1、确保用户对文件有读写及执行权限

chmod a+x test.sh

2、然后修改文件格式(如果是从winodws搬过来的会显示dos格式,要把它改成unix格式)

(1)使用vi工具

  vi test.sh

(2)利用如下命令查看文件格式 
          :set ff 或 :set fileformat 
         可以看到如下信息 
           fileformat=dos 或 fileformat=unix 
 (3) 利用如下命令修改文件格式 
           :set ff=unix 或 :set fileformat=unix 
           :wq (存盘退出)

3、最后再执行

./test.sh

相关文章

网友评论

      本文标题:linux下执行sh脚本,提示Command not found

      本文链接:https://www.haomeiwen.com/subject/jhoayhtx.html