sh文件运行提示 “/bin/bash^M: 坏的解释器: 没有那个文件或目录”
今天偶然写了个sh文件,运行的时候提示
/bin/bash^M: 坏的解释器: 没有那个文件或目录
#!/bin/bash
echo hello word!
后来发现原因是我在windows下编写的。
在linux下通过cat -A hello.sh发现:
#!/bin/bash^M$
echo hello word!^M$
多了一些东西。
通过vim hello.sh 重新编辑就好了
今天偶然写了个sh文件,运行的时候提示
/bin/bash^M: 坏的解释器: 没有那个文件或目录
#!/bin/bash
echo hello word!
后来发现原因是我在windows下编写的。
在linux下通过cat -A hello.sh发现:
#!/bin/bash^M$
echo hello word!^M$
多了一些东西。
通过vim hello.sh 重新编辑就好了