diff options
Diffstat (limited to 'bin/reverse')
-rwxr-xr-x | bin/reverse | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/reverse b/bin/reverse new file mode 100755 index 0000000..1821221 --- /dev/null +++ b/bin/reverse @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ "${#}" = "0" ] +then + awk '{ a[NR]=$0 } END { for(i=NR; i; --i) print a[i] } ' +else + for FILE in ${@} + do + awk '{ a[NR]=$0 } END { for(i=NR; i; --i) print a[i] } ' ${FILE} > ${FILE}.tmp + mv ${FILE}.tmp ${FILE} + done +fi |