IT 244: Introduction to Linux/Unix
Answers to Class 23 Ungraded Quiz

  1. What do [ and ] mean when used in an if statement?
    they stand for the test command
  2. What are the keywords used to mark a block of commands in an if ... then statement?
    then and fi
  3. What are the keywords used to mark the FIRST block of commands in an if ... then ... else statement?
    then and else
  4. What are the keywords used to mark the SECOND block of commands in an if ... then ... else statement?
    else and fi
  5. What are the keywords used to mark the block of commands following elif?
    then and either else or elif or fi
  6. Is there any limit to the number of blocks of commands you can have in an if ... elif ... else statement?
    no
  7. How would you run the script do_something.sh if you wanted to print each line of the script before it was executed?
    bash  -x  do_something.sh
  8. If you were debugging a script as in the example above, how would Bash mark the lines of the script itself to distinguish them from the output of the script?
    by starting each line with a +
  9. What has to follow each elif in an if ... elif ... else statement?
    a Unix command
  10. How does the test command indicate that the logical expression it is evaluating is true?
    by returning a status code of 0