Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the word "Hello" in red color using ANSI escape codes.
Bash Scripting
echo -e "\033[[1]mHello\033[0m"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 32 which is green instead of red.
Forgetting to reset color with \033[0m.
✗ Incorrect
The ANSI escape code 31 sets the text color to red. The code \033[31m starts red color, and \033[0m resets it.
2fill in blank
mediumComplete the code to print the word "Success" in green color using ANSI escape codes.
Bash Scripting
echo -e "\033[[1]mSuccess\033[0m"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 31 which is red instead of green.
Not using -e option with echo to enable escape codes.
✗ Incorrect
The ANSI escape code 32 sets the text color to green. It is used here to print "Success" in green.
3fill in blank
hardFix the error in the code to print "Warning" in yellow color.
Bash Scripting
echo -e "\033[[1]mWarning\033[0m"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 34 which is blue instead of yellow.
Forgetting to reset color with \033[0m.
✗ Incorrect
The ANSI escape code 33 sets the text color to yellow. Using 33 correctly colors the text "Warning" in yellow.
4fill in blank
hardFill both blanks to print "Error" in bold red color using ANSI escape codes.
Bash Scripting
echo -e "\033[[1];[2]mError\033[0m"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of 1 for bold style.
Mixing up color codes.
✗ Incorrect
The code 1 makes the text bold, and 31 sets the color to red. Combined as \033[1;31m, it prints bold red text.
5fill in blank
hardFill all three blanks to print "Note" in underlined blue color using ANSI escape codes.
Bash Scripting
echo -e "\033[[1];[2]mNote\033[[3]m"
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 4 for underline.
Forgetting to reset with \033[0m.
✗ Incorrect
4 is for underline, 34 is blue color, and 0 resets the style. So \033[4;34m starts underlined blue text, and \033[0m resets it.