Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to assign the text "Hello" to a variable named greeting.
Bash Scripting
greeting=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Assigning the string without quotes causes errors or unexpected behavior.
Using single quotes when double quotes are expected for variable expansion.
✗ Incorrect
In bash, to assign a string with spaces or special characters, you must enclose it in quotes. Double quotes allow variable expansion if needed.
2fill in blank
mediumComplete the code to print the value of the variable name.
Bash Scripting
echo [1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Printing the variable name as a string instead of its value.
Forgetting the $ sign before the variable.
✗ Incorrect
To print the value of a variable in bash, prefix it with a dollar sign ($).
3fill in blank
hardFix the error in the code to correctly assign the string "World" to the variable word.
Bash Scripting
word=[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing quotes or mismatched quotes cause syntax errors.
Using only one quote at start or end.
✗ Incorrect
Strings must be enclosed in matching quotes. Option A uses proper double quotes.
4fill in blank
hardFill both blanks to assign "Hello" to greeting and then print it.
Bash Scripting
greeting=[1] echo [2]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Printing the variable name without $.
Assigning string without quotes.
✗ Incorrect
Assign the string with quotes, then print the variable value with $.
5fill in blank
hardFill all four blanks to assign "User" to user, assign "Name" to name, then print both variables separated by a space.
Bash Scripting
user=[1] name=[2] echo [3] [4]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes in assignments.
Printing variable names without $.
Not separating variables with space in echo.
✗ Incorrect
Assign strings with quotes, then print variables with $ prefix separated by space.