Solve the error "/bin/bash^M: bad interpreter\\" when running the script

888u

Last update at :2024-06-15,Edit by888u

Today when Snail was debugging a certain script, there was an error message like \\"/bin/bash^M: bad interpreter: No such file or directory\\". I originally thought it was because there were no comments in the script. Take effect, and check the space problem. But it was still like this. Later, I thought it was a problem with file compilation and encoding in the WIN system.

After consulting the document, it turns out that it is really a problem with the encoding format. It needs to be converted before execution. Here you can use the dos2unix encoding format conversion tool. It is not installed in the default system. Here we install it directly with yum.

yum install dos2unix -y

After the installation is complete, we will execute the script to convert the file encoding format.

dos2unix file name

Then there will be no problem if you execute the file again.

Recommended site searches: domain name space registration, domain name registration information query, aaa server, US PHP space, website virtual host space, IP proxy free version 2.80, mainland China registration-free host, Singapore server, managed host, all-round virtual host,

Solve the error

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码