shell脚本报错:-bash: xxx: /bin/bash^M: bad interpreter: No such file or directory

当我们把文件从windows系统中编辑的文件拷贝到linux系统中,如果我们执行文件会保存如下的错:

shell脚本报错:-bash: xxx: /bin/bash^M: bad interpreter: No such file or directory

1.在命令模式中使用set ff命令查看文件格式

:set ff

可以看到文件的格式为dos:

fileformat=dos

2.通过命令行修改文件格式

:set ff=unix

执行完命令后再次通过set ff命令查看文件格式,可以看到文件的格式为unix:

fileformat=unix

 

posted @ 2019-04-30 15:22  博小园  阅读(562)  评论(0编辑  收藏  举报
回到顶部