EN
Bash - "/bin/bash^M: bad interpreter: No such file or directory" error
2
answers
3
points
What is the reason I am getting the following error when I'm trying to run my script under Debian 11?
Error message:
/bin/bash^M: bad interpreter: No such file or directory
I was developing my application under Windows and it was working under Git Bash. After I pushed the repo on Windows and pulled it on Linux my bash script stopped working.
2 answers
6
points
Use:
dos2unix your-script.sh
See also
0 comments
Add comment
3
points
It looks like Git replaced new line characters to the different ones than Bash requires.
Fix the script file using:
sed -i -e 's/\r$//' your-script.sh
Then run the script file using:
./your-script.sh
0 comments
Add comment