在windows环境下用notepad++写好shell,在linux运行报bash: ./a.sh: /bin/bash^M: bad interpreter: No such file or directory
用vim a.sh进入a.sh这个文件, 然后在底部模式下, 执行:set ff查看一下, 结果发现fileformat=dos
vim a.sh进入a.sh后, 在底部模式下, 执行:set fileformat=unix后执行:x或者:wq保存修改。 然后就可以执行./a.sh运行脚本了