Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign the value 'hello' to the variable greeting.
Bash Scripting
greeting[1]"hello"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign causes syntax errors.
Using double equals (==) instead of a single equals.
✗ Incorrect
In bash scripting, variable assignment must have no spaces around the equals sign (=).
2fill in blank
mediumComplete the code to assign the output of the date command to the variable today.
Bash Scripting
today[1]$(date) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using == instead of = for assignment.
✗ Incorrect
Variable assignment in bash requires no spaces around the equals sign (=), even when assigning command output.
3fill in blank
hardFix the error in the variable assignment to set count to 5.
Bash Scripting
count[1]5
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using spaces around the equals sign.
Using double equals (==) which is for comparison, not assignment.
✗ Incorrect
In bash, variable assignment must use a single equals sign with no spaces around it.
4fill in blank
hardFill both blanks to assign the string 'world' to the variable name without spaces around the equals sign.
Bash Scripting
name[1][2]"world"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using single quotes instead of double quotes (both work but double quotes are common).
✗ Incorrect
Use '=' with no spaces for assignment and quotes around the string value.
5fill in blank
hardFill all three blanks to assign the output of the command 'whoami' to the variable user with no spaces around the equals sign.
Bash Scripting
user[1]$([2][3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding spaces around the equals sign.
Using incorrect command names or extra spaces inside $().
✗ Incorrect
Assign command output with no spaces around =, use $(command) syntax without extra spaces inside.