在window上面新建的sh文件在linux执行失败,检查原因主要是window创建的sh文件格式是dos,linux执行的sh文件格式需要unix格式。
如何查看sh文件格式:

$ vim test.sh
> :set ff

如何修改sh文件格式:

$ vim test.sh
> :set ff=unix
> :wq

相关文章: