#!/bin/bash # showfile--Shows the contents of a file, including additional useful info. setglobal width = '72'for input in @Argv { echo $input setglobal lines = $[wc -l < $input | sed 's/ //g] setglobal chars = $[wc -c < $input | sed 's/ //g] setglobal owner = $[ls -ld $input | awk '{print $3}] echo "-----------------------------------------------------------------" echo "File $input ($lines lines, $chars characters, owned by $owner):" echo "-----------------------------------------------------------------" while read line { if test $(#line) -gt $width { echo $line | fmt | sed -e '1s/^/ /' -e '2,$s/^/+ /' } else { echo " $line" } } < $input echo "-----------------------------------------------------------------" } | $(PAGER:more) exit 0