Vim Converting File Types

December 7, 2010

I had a problem with a unix script that was originally created on Windows. It was giving the error:

bash: ./script: /bin/bash^M: bad interpreter: No such file or directory

To fix this we need to get rid of the ^M line endings.

Edit file in vim.

:set ff=unix
:wq

This will write the file out in the correct format, and it can now be run.

References

Tags: vim vi