- The problem statement, all variables and given/known data:
Arguments:
http://farm9.staticflickr.com/8070/8212131370\_8b6e8c10c5_c.jpg
I am given these three arguments. $1, $2, $3
The first argument is the path to a directory.
So, how would I go into the directory and compare files?
I also need to check if the second argument (a C program) can compile or not. I don't know how.
I have no idea.
Try to keep your answer simple. I'm new to this.
Thank you so much for your time.
(I am learning Bourne shell)
- Relevant notes:
This is the handout of my assignment:
http://farm9.staticflickr.com/8346/8211167069\_8fc3096663_z.jpg
http://farm9.staticflickr.com/8201/8208444087\_510263744b_c.jpg
- My attempt at a solution:
if (test $# -ne 3)
then
echo Usage a2.sh <testdir> <C program> <time limit>
exit 1 # exit failure
elif (test ! -d $1) # arg1 is not a directory
then
echo $1 is not a directory.
exit 1 # exit failure
elif (test ! -r $1) || (test ! -x $1) # arg1 is a directory, but not readable or excutable.
then
echo $1 is not accessible.
exit 1 # exit failure
elif (test ! -e $2) || (test ! -r $2) #arg2 doesn't exist, or is not readable.
then
echo $2 is not accessible.
elif(test # check if arg2 doesn't compile. I don't know this case!!!!!!!!!!!!!!)
elif (test -ne [0-9][0-9]*)
then
echo The third argument must be an integer.
fi
fi
fi
fi
fi
fi
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
York University, Toronto, Canada, Bil , cse 203 1