Saturday, April 28, 2012

set fileformat=unix

Short, sweet and very useful.

Was running a shell script in Linux to execute some SQL, and got the following error during start of script:

^M: bad interpreter
 
Yes, received the script from the windows.
 
Now to rectify this, open the script file in VI editor and give following command:
 
:set fileformat=unix
 
save it with :wq
 
and run it again.
 
Should Run like a beaut. 

1 comment:

Unknown said...

An easier way to do this is using the dos2unix program.