Bad interpreter error
I use shell scripts for a few jobs.
Recently I rebuilt a laptop and installed a few scripts from a working machine. The other day I went to run one of the scripts from a command line and got the following:
/bin/bash^M: bad interpreter: No such file or directory
Now the new machine had an identical setup to the old and the script I was trying to run had the right permissions(and of course ran perfectly on the old machine), so the problem had to lie with the formatting of the script file ( and the ^M was a bit of a hint too?). Somehow the file transfer had corrupted the script file and trying to edit it didn't fix it.
A simple fix.
I used the following:
sed -i -e 's/\r$//' myfile.sh
The file then ran perfectly.
I was sent over here by your alter ego to check if this comment of mine is blocked or not. Since I’m not a spammer even though I had spam for dinner last night (with cabbage–wonderful), this comment should go through without a problem. If not, I’ll report as such.