DOS-based file format

I was running into an issue where a script I’d gotten from the net would not run and exited with an error:

[root@asterisknow ~]# flip1405.sh -s
-bash: /usr/local/sbin/flip1405.sh: /bin/sh^M: bad interpreter: No such file or directory
[root@asterisknow ~]#

Turned out to be that the file was in a DOS-based format. I simply did the following in vim to correct this:

:set fileformat=unix
:wq

This set the file to the unix format and allowed me to run the script without issue. 🙂