Ever get the error
/bin/bash^M: bad interpreter: No such file or directory?
This frequently occurs when moving files between Windows and OSX/Linux environments and the files haven’t been saved with the correct encoding.
There are a few ways to fix it, including using
dos2unix or saving the offending file with the correct encoding, but here’s my favourite:
Simply run the above bash script on the broken file and the error should be fixed, just like that!