Bash - Check your knowledge¶
Every order must return a return code at the end of its execution:
A return code of 0 indicates an execution error:
The return code is stored in the variable
The test command allows you to:
- Test the type of a file
- Test a variable
- Compare numbers
- Compare the content of 2 files
- Concatenates 2 strings of characters
- Performs mathematical operations
- Display text on the screen
Does the syntax of the conditional structure below seem correct to you? Explain why.
if command command if $?=0 else command if $?!=0 fi
What does the following syntax mean:
- Displays a replacement value if the variable is empty
- Display a replacement value if the variable is not empty
- Assigns a new value to the variable if it is empty
Does the syntax of the conditional alternative structure below seem correct to you? Explain why.
case $variable in value1) commands if $variable = value1 value2) commands if $variable = value2 *) commands for all values of $variable != of value1 and value2 ;; esac
Which of the following is not a structure for looping?
Author: Antoine Le Morvan
Contributors: Steven Spencer