Class 23 Quiz Flashcards
What do [ and ] mean when used in an if statement?
they stand for the test command
What are the keywords used to mark a block of commands in an if … then statement?
then and fi
What are the keywords used to mark the first block of commands in an if … then … else statement?
then and else
What are the keywords used to mark the second block of commands in an if … then … else statement?
else and fi
What are the keywords used to mark the block of commands following elif?
then and either else or elif or fi
Is there any limit to the number of blocks of commands you can have in an if … else … elif statement?
no
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
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 +
What has to follow each elif in an if … else … elif statement?
a Unix command
How does the test command indicate that the logical expression it is evaluating is true?
by returning a status code of 0