Skip to content

Instantly share code, notes, and snippets.

@dodocat
Created April 19, 2016 09:20
Show Gist options
  • Select an option

  • Save dodocat/633320159964dd67744d1a40d31db0b2 to your computer and use it in GitHub Desktop.

Select an option

Save dodocat/633320159964dd67744d1a40d31db0b2 to your computer and use it in GitHub Desktop.
Convert dos \n\r to unix \n
#!/bin/bash
showUsage()
{
echo "Usage: dos2unixdir [destdir]"
exit 0
}
dir=$PWD
if [ $# -gt 1 ]
then
showUsage
fi
if [ $# -gt 0 ]
then
dir=$1
fi
for i in `find $dir`
do
if [ ! -d $i ]
then
echo "processing file..." $i
dos2unix $i $i
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment