#!/bin/sh
#
#   A script to count the number of files in
#     a directory specified by the User
#
USAGE="Usage: fileCount2 <targetDir>"

if [ $# -ne 1 ]       # if number of command line args is not equal to 1
then
    echo $USAGE
    exit 1
fi

if [ ! -d $1 ]       # testing if the arg is a directory
then
    echo $USAGE
    exit 2
fi

if [ ! -r $1 ]      # testing if the arg is readable
then
    echo $USAGE
    exit 2
fi

echo "Number of files in dir $1:"
/bin/ls -A $1 | /usr/bin/wc -l  









