fir3net
PPS-Firenetbanner-780.5x190-30-03-17

/bin/bash^M: bad interpreter: no such file or directory

This is caused by additional carriage returns within your script. In Windows the end of a line is denoted by CRLF (Carriage-Return, Line-Feed). In Unix-like systems, the end of a line is donated by a single LF. This means when you try to run your script, every line has an extra carriage return which in turn causes issues.

One solution to this is to strip out the extra carriage returns, which can be done via a simple sed command.
sed -i 's/{ctrl-v}{ctrl-m}//g' [file]

About the Author

RDonato

R Donato

Rick Donato is the Founder and Chief Editor of Fir3net.com. He currently works as a Principal Network Security Engineer and has a keen interest in automation and the cloud.

You can find Rick on Twitter @f3lix001