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?