so i was trying to run a shell script i created and had emailed to myself, once i downloaded it i was getting this error :

bad interpreter: No such file or directory

after many a wasted minutes i came up with this for a fix

check the file first to make sure that all dos encoding has been stripped from file:

head -1 graph_script | od -c

which gives us this output:

0000000 # ! / b i n / b a s h \r \n
0000015

— see the slash r ??

next we run dos2unix filename

then run the check again and check output:

0000000 # ! / b i n / b a s h \n
0000014

— all done