Bash - Check your knowledge¶
Every order must return a return code at the end of its execution:
- True
- False
A return code of 0 indicates an execution error:
- True
- False
The return code is stored in the variable $@
:
- True
- False
The test command allows you to:
- Test the type of a file
- Test a variable
- Compare numbers
- Compare the content of 2 files
The command expr
:
- 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
- True
- False
What does the following syntax mean: ${variable:=value}
- 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
- True
- False
Which of the following is not a structure for looping?
- while
- until
- loop
- for
Author: Antoine Le Morvan
Contributors: Steven Spencer, Ganna Zhyrnova