- The problem statement, all variables and given/known data:
The script usage will be as follows:
library.third source_directory [destination directory]
- Your script will display an appropriate error message and exit with status 3 if no parameters are given
- Your script will display an appropriate error message and exit with status 4 if the source directory does not exist
- Your script will display an appropriate error message and exit with status 5 if the source is not a directory
- Your script will display an appropriate error message and exit with status 6 if destination directory does not exist
- Your script will display an appropriate error message and exit with status 7 if destination is not a directory
- Relevant commands, code, scripts, algorithms:
Simple Unix Bash commands have been used in this program, that is all that has been taught in the course so far. By this, I mean if statements and basic looping, nothing complex.
- The attempts at a solution (include all code and scripts):
The section I am having trouble with is:
Your script will display an appropriate error message and exit with status 5 if the source is not a directory.
The statement does not recognize any file type as a directory.
DIR="$1"
if [ $# -lt 1 ]
then
echo "Incorrect Usage"
exit 3
elif [ ! -d "$DIR" ]
then
echo "Directory does not exist!"
exit 4
elif [ "$DIR" != -d ]
then
echo "Not a Directory"
exit 5
else
echo "Path is okay"
fi
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Seneca College of Applied Arts of Technology, Toronto, Canada, Michal Heidenreich, OPS105