Schedule
Labs
Assignments
TA office hours
Topic videos
Some course notes
Extra problems
Lecture recordings
A shell script containing the following code is executed:
if x then y else z fi
a) Write the command 'x' (either as a shell script, or in C if you prefer) so that the command 'y' will be executed.
exit 0C program:
int main() { return(0); }All sorts of other shell scripts are possible, such as
cat /dev/null
b) Write the command 'x' (either as a shell script, or in C if you prefer) so that the command 'z' will be executed.
exit 1C program:
int main() { return(1); }All sorts of other shell scripts are possible, such as
rm / 2>/dev/nullor
falseor
test 3 -eq 4