Error in running shell script: – bash:. / test1. Sh: / bin / bash ^ m:

Time:2021-2-23

Linux runs. / test1.sh with an error, as follows

[[email protected]192 public]# ./test1.sh
-bash: ./test1.sh: /bin/bash^M: bad interpreter: No such file or directory

resolvent

1. Run directly under the shell file directory

[[email protected]192 public]# sed -i 's/\r$//' test1.sh

2. After entering test1.sh, VIM executes set fileformat = UNIX at the bottom, and then executes WQ to save the file

[[email protected]192 public]# vi test1.sh

Error in running shell script: - bash:. / test1. Sh: / bin / bash ^ m:

Error in running shell script: - bash:. / test1. Sh: / bin / bash ^ m:

Run again. / test1.sh succeeded

This work adoptsCC agreementReprint must indicate the author and the link of this article


All misfortunes are due to one’s own failure