Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print a double quote inside the string.
Bash Scripting
echo "She said, \[1]Hello\[1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single quotes instead of escaping double quotes.
Not escaping the double quotes, causing syntax errors.
✗ Incorrect
To print double quotes inside a double-quoted string in bash, you escape them with a backslash (\").
2fill in blank
mediumComplete the code to print a newline character using echo.
Bash Scripting
echo -e "First line[1]Second line"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using \t which inserts a tab instead of a newline.
Not using -e option, so escape sequences are not interpreted.
✗ Incorrect
The escape sequence \n inserts a newline in the output when used with echo -e.
3fill in blank
hardFix the error in the code to correctly print a backslash character.
Bash Scripting
echo "This is a backslash: [1]"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single backslash which escapes the next character.
Using a forward slash instead of backslash.
✗ Incorrect
To print a single backslash, you need to escape it with another backslash, so use \\.
4fill in blank
hardFill both blanks to print a tab and a newline in the output.
Bash Scripting
echo -e "Column1[1]Column2[2]End"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up \r (carriage return) with \n (newline).
Not using -e option so escapes are not processed.
✗ Incorrect
Use \t for tab and \n for newline inside echo -e to format output.
5fill in blank
hardFill all three blanks to create a string with a literal dollar sign, a double quote, and a backslash.
Bash Scripting
echo "Price: [1]100, Quote: [2]Hello[2], Path: C:[3]Users"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not escaping the dollar sign causing variable expansion.
Using single backslash for backslash printing.
Not escaping double quotes causing syntax errors.
✗ Incorrect
Escape $ with \$, double quote with \" and backslash with \\ inside double quotes.