#!/bin/sh -u # $0 [args ...] # Count and character count the arguments, without blanks. # -IAN! idallen@ncf.ca export PATH=/bin:/usr/bin umask 022 # Remove both blanks and the trailing newline from the echo. # count=$(echo "$*" | tr -d ' \n' | wc -c) # Bonus: set the plurals on the output line # s1=s ; test "$#" -eq 1 && s1='' s2=s ; test "$count" -eq 1 && s2='' echo "Count: $# argument$s1 and $count non-blank character$s2." # this script exits with status of last command