1.sh (311B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/bin/sh -e [ "$#" -gt 0 ] || { printf "usage: %s datafile\n" "$0" >&2 exit 1 } i=0 prev=0 numlarger=0 while read -r line; do i=$((i + 1)) [ "$i" = 1 ] && continue [ "$line" -gt "$prev" ] && numlarger=$((numlarger+1)) prev="$line" done < "$1" printf "of %d lines, %s are greater\n" "$i" "$numlarger"