How would you write a test that says if /tmp/foo is a directory or USERS is greater than 5? How would you write a test that says if /tmp/foo is a directory or USERS is greater than 5? Answer - test -d /tmp/foo -o $USERS -gt 5
What is the meaning of $(( $i + 1)) ? What is the meaning of $(( $i + 1)) ? Answer: 1 will be added to the i variable
A conditional that lets you make multiple comparisons with a pattern is called: A conditional that lets you make multiple comparisons with a pattern is called: Answer: case
The if command looks for what exit code to consider a condition to be true? The if command looks for what exit code to consider a condition to be true? Answer: 0
Given the following script that is run through ./test.sh hello goodbye: Given the following script that is run through ./test.sh hello goodbye: Answer: if [ -f $2 ]; then echo "I am here" fi When will I am here be printed? If a file called "goodbye" exists in the current directory
Which of the following are correct about for and while loops? Which of the following are correct about for and while loops? Answer: - for loops operate over a fixed list of items - while loops have a test each cycle to determine if it should run again