Use echo
statements in place of commands to test
if [[ -d $dir_name ]]; then
if cd $dir_name; then
echo rm * # TESTING
else
echo "cannot cd to '$dir_name'" >&2
exit 1
fi
else
echo "no such directory: '$dir_name'" >&2
exit 1
fi
exit # TESTING
Important to develop and apply good test cases.
edge and corner cases.
- dirname contains the name of an existing directory
- dirname contains the name of a nonexistent directory
- dirname is empty.