In this article I will show you a short bash script that will do a dos2unix text file conversion.
edit a new file with gedit
insert the following line:
1: #!/bin/bash
2: cat $1|tr -d '\015'
Line number 1 tells your system that this file is a set of commands that will be executed by the bash CLI.
Line number 2 convert from dos to unix
save this file as d2u.sh and exit from gedit
from a terminal set the file execution attribute typing
# chmod +x d2u.sh
and move it into /usr/local/bin
# mv d2u.sh /usr/local/bin
now the script is ready to run.
Try this script typing the following command:
# d2u.sh <dos_file_name>