#!/bin/ksh # @(#) Scan a shell script for problems #..# systems: #..# sites: tag=`basename $0` [ -f /usr/ucb/tr ] && alias tr=/usr/ucb/tr usage="Usage: ${tag} " while [ $# -gt 0 ]; do case "$1" in -x|-v) set "$1" ;; -vi) vi $0; exit ;; -about) echo "$tag was written by David Ledger" echo "dledger@ivdcs.demon.co.uk" exit ;; -h) echo "$tag extracts various syntacticly relevant special" echo "characters from script files, to ease the task of finding" echo "syntax errors." echo "" echo "$tag -quotes - shows \", ' and \` quotes." echo "$tag -square - shows [] brackets" echo "$tag -curly - shows {} braces" echo "$tag -paren - shows () parentheses" echo "$tag -all - shows all the above" echo "$tag -full - as -all, but preserves line breaks" echo " and numbers the lines." echo "" echo "Single ';' are discarded, but ';;' is retained as the" echo "trailing part of the case statement delimiters." echo "$tag tries to format case statement ) ;; sequences, and" echo "put a space after right braces and parenteses and pairs" echo "of such." echo "\$(...) and \$((...)) are treated as (...) and ((...))" echo "" exit ;; -quo*) mode=quotes ;; -sq*) mode=square ;; -curl*) mode=curly ;; -par*) mode=paren ;; -all) mode=all ;; -full) mode=full ;; *) f="$1" ;; esac shift done case ${mode-quotes} in quotes) echo "Counting \" quotes" tr -dc "\""