|
In fact, the main program may be safer like this
echo "input a directory name"
read Dname
if [-n $Dname ]; then
if [-d $Dname ]; then
echo'The input parameter is not a valid directory'
exit 1
fi
else
$Dname="."
fi
compare
------------------------------------------
Generally, the input of directory parameters is best to use command line parameters, so that it is more convenient for programs to call each other.
In the result output part defined by function compare, it is best to change echo "the result of compare:" to
echo "the result of compare in"`pwd`":" |
|