Linux执行.sh文件,提示No such file or directory的问题的解决方法

04-26

Linux执行.sh文件,提示No such file or directory的问题
在window平台下,写好shell脚本文件,迁移到linux平台,赋过可执行权限,执行该sh文件,
却提示No such file or directory。ls 了下,确实有该文件,怎么会事呢,
难道是文件格式兼容性问题?用vim打开该sh文件,输入:
[plain]
:set ff
回车,显示fileformat=dos,重新设置下文件格式:
[plain]
:set ff=unix
保存退出:
[plain]
:wq
再执行,竟然可以了。这个事情又给我提了次醒,程序尽量在linux下编写,迁移时,也许会少很多问题。