IT 244: Introduction to Linux/Unix
Quiz 10 Answers

  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 SECOND block of commands in an if ... then ... else statement?
    else and fi
  4. What are the keywords used to mark the block of commands following elif?
    then and either else or elif or fi
  5. Is there any limit to the number of blocks of commands you can have in an if ... else ... elif statement?
    no
  6. In a for ... in loop, where does the loop variable get its values?
    from the list of values following the keyword in
  7. In a simple for loop, where does the loop variable get its values?
    from the command line arguments
  8. Should the loop variable in a for loop have a $ in front of it?
    no
  9. When does a while loop stop running?
    when the command following while returns an exit status that is not 0
  10. What does the break command in a loop do?
    jumps completely out of the loop