parameters

i'm supposed to come up with a script that
-accepts a directory as an optional command line parameter
-display an error message and terminates if more than one parameter is provided
-use the current directory if no parameter is provided
-displays an error message and terminates if the provided parameter is not a directory

this is what i came up with..

if [ $# -ge 2 ]; then
       echo "Too many parameters. Usage: file-info [directory]"
       exit
fi

if [ -d $1 ]; then
       echo "Processing `pwd`: "
       cd $1
       ls -l
       cd
   else
       echo "$1 is not a valid directory... terminating..."
fi

my question is, how do i use the current directory if no parameter is provided?

if [ -d "$1" ]; then
  cd "$1"
else
  echo "$0: $1 is not a directory" >&2
  exit 255
fi
ls -l

I tried that and it still doesn't work.

If no argument is provided, set the first argument to current directory.

if [ $# -ge 2 ]; then
       echo "Too many parameters. Usage: file-info [directory]"
       exit
elif [ $# -eq 0 ];then set `pwd`;
fi

Thanks! that helped me alot!