summaryrefslogtreecommitdiffstats
path: root/bin/reverse
blob: 182122157e019a2aca1c6e5b385cad84eeed85ab (plain)
1
2
3
4
5
6
7
8
9
10
11
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