Allen Lesern meines Blogs wünsche ich ein schönes Osterfest.
Lasst euch vom Osterhasen reich mit Eiern beschenken ;)
#!/bin/bash
if [ "$1" == "-h" ] || [ "$#" -gt 3 ]; then
echo "Usage: dos2unix [OPTION] [SOURCE] [TARGET]"
echo "dos2unix"
echo ""
echo "A program to convert MS-DOS formatted texts into UNIX understandable format."
echo "Released under the terms of GPLv3 by Leszek Lesner"
echo ""
echo "Options:"
echo "-h List this help"
echo "-v List version number"
elif [ "$1" == "-v" ]; then
echo "dos2unix -- Version 1.0"
echo "Released under the terms of GPLv3"
echo "Copyright 2009 Leszek Lesner"
elif [ "$#" == 2 ]; then
sed 's/ $//' $1 > $2
elif [ "$#" == 1 ]; then
sed 's/ $//' $1 > $1.tmp;
mv $1.tmp $1;
else
sed 's/ $//' $1;
fi