mirror of https://github.com/tLDP/LDP
24 lines
433 B
Bash
24 lines
433 B
Bash
#!/bin/bash
|
|
# du.sh: DOS to UNIX text file converter.
|
|
|
|
E_WRONGARGS=65
|
|
|
|
if [ -z "$1" ]
|
|
then
|
|
echo "Usage: `basename $0` filename-to-convert"
|
|
exit $E_WRONGARGS
|
|
fi
|
|
|
|
NEWFILENAME=$1.unx
|
|
|
|
CR='\015' # Carriage return.
|
|
# Lines in a DOS text file end in a CR-LF.
|
|
|
|
tr -d $CR < $1 > $NEWFILENAME
|
|
# Delete CR and write to new file.
|
|
|
|
echo "Original DOS text file is \"$1\"."
|
|
echo "Converted UNIX text file is \"$NEWFILENAME\"."
|
|
|
|
exit 0
|