#!/bin/sh -u # Count the number of lines in the first file name argument. # Print an error if the argument is missing, or is not a file. # -IAN! idallen@idallen.ca # Make sure we have one argument. # if [ $# -eq 1 ] ; then path="$1" echo "You are using pathname '$path'." if [ -f "$path" ] ; then echo "The path '$path' is a plain file." echo "Here is the line count:" wc -l "$path" else echo 1>&2 "$0: The path '$path' is missing or is not a file" fi else # Wrong number of arguments. Issue an error message. # if [ $# -eq 0 ] ; then echo 1>&2 "$0: expecting exactly one argument - none found" else # Include the extra arguments in the error message text: # echo 1>&2 "$0: expecting exactly one argument, found $# ($*)" fi fi