Usually I use the same vim scripts in Windows and Linux. Sometimes I copy the scripts from Windows to Linux and they still in dos format. Therefore when the scripts executed some errors come out because of the difference between Windows' and Linux's carriage line format.
Below is my way to convert several dos files into unix file
Using dos2unix
Using $ find ~/.vim -name "*.vim" -print0 | xargs -0 dos2unix
Using fromdos
To use #!/bin/sh
list=`find ~/.vim -name "*.vim" -print`
for files in $list; do
fromdos < $files > $files-x
mv $files-x $files
done