nrev.sh (515B)
1 #!/bin/sh 2 3 version="1.0" 4 5 if [ "$1" = "-v" ]; then echo version; exit; 6 elif [ "$1" = "-h" ]; 7 then 8 printf "Nrev - Narthex reverser ${version} \n"; 9 printf "By Michael C. Dim. <mk@mcdim.xyz>\n\n"; 10 printf '%s\n' "-h Print this panel & exit"; 11 printf '%s\n\n' "-v Print current version & exit"; 12 printf "Usage: nrev [FILENAME]\n"; 13 printf " cat [FILENAME] | nrev\n"; 14 exit; 15 fi 16 17 filename=$(mktemp); 18 19 while read line 20 do 21 echo "$line" >> $filename; 22 done < "${1:-/dev/stdin}" 23 24 cat $filename; 25 cat $filename | rev;