#! /bin/sh
# scan_sort - SHOW SORTED scan LIST
# Usage: scan_sort [scan arguments]
stat=1  # DEFAULT EXIT STATUS; RESET TO 0 BEFORE NORMAL EXIT
out=$HOME/sorted_scan
temp=/tmp/ss$$
trap 'rm -f $temp; exit $stat' 0
trap 'echo Quitting early... 1>&2' 1 2 15

# SORT ON THE ADDRESS FIELD (SKIP 12 CHARACTERS TO FIND IT):
scan | sort +0.12 >$temp
more $temp

echo -n "Save that list in the '$out' file (y/n)? " 1>&2
read yn
case "$yn" in
y*) cp $temp $out ;;
esac

stat=0
exit
