Home‎ > ‎CIS 98‎ > ‎

Practice Final

This is the practice final for Spring 2016. 

Reading Code

Look at the frodo program (/home/cis98/bin/frodo). On line 326 the program parses its arguments. Based on reading the code can you determine:
  1. What arguments does frodo take? 
  2. Do the arguments do themselves take arguments?
  3. What happens when there's an error processing arguments?
  4. What exit codes are returned upon an error? 
You should be able to answer the questions and figure out what program arguments set the SPEED, NAPTIME, MAP and CMD variables. 

Syntax

The "if" statement comes in four basic forms:
 
if <command>

if [ <statement> ] 

if [[ <statement> ]] 

if (( <statement> )) 

Do you understand the difference between these forms and why you would use each one? If not, what are the best resources on Google to help you. I suggest bookmarking them. 

Kill and Signals

What does the kill program do? Does the kill command always kill another program? Write an example of a BASH script that does something when you run the following command:

kill -2 <PID-of-your-program>

Comments