0
0
Bash Scriptingscripting~10 mins

Color output (ANSI escape codes) in Bash Scripting - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
A34
B32
C33
D31
Attempts:
3 left
💡 Hint
Common Mistakes
Using 32 which is green instead of red.
Forgetting to reset color with \033[0m.
2fill in blank
medium

Complete 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'
A31
B35
C32
D33
Attempts:
3 left
💡 Hint
Common Mistakes
Using 31 which is red instead of green.
Not using -e option with echo to enable escape codes.
3fill in blank
hard

Fix 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'
A33
B34
C31
D32
Attempts:
3 left
💡 Hint
Common Mistakes
Using 34 which is blue instead of yellow.
Forgetting to reset color with \033[0m.
4fill in blank
hard

Fill 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'
A1
B31
C0
D4
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 instead of 1 for bold style.
Mixing up color codes.
5fill in blank
hard

Fill 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'
A4
B34
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 4 for underline.
Forgetting to reset with \033[0m.