Bash - Check your knowledge¶
Among these 4 shells, which one does not exist:
- Bash
- Ksh
- Tsh
- Csh
What is the correct syntax to assign a content to a variable:
-
variable:=value
-
variable := value
-
variable = value
-
variable=value
How to store the return of a command in a variable:
-
file=$(ls)
-
file=
ls`` -
file:=$ls
-
file = $(ls)
-
file=${ls}
The read command allows you to read the contents of a file:
- True
- False
Which of the following is the correct syntax for the command cut
:
-
cut -f: -D1 /etc/passwd
-
cut -d: -f1 /etc/passwd
-
cut -d1 -f: /etc/passwd
-
cut -c ":" -f 3 /etc/passwd
Which command is used to shift positional variables:
-
left
-
shift
-
set
-
array
Which command transforms a string into positional variables:
-
left
-
shift
-
set
-
array
Author: Antoine Le Morvan
Contributors: Steven Spencer, Ganna Zhyrnova