Recall & Review
beginner
What are ANSI escape codes used for in bash scripting?
ANSI escape codes are special sequences that control text formatting, color, and other output options in the terminal.
Click to reveal answer
beginner
How do you print red colored text in bash using ANSI escape codes?
Use the code \033[31m before the text and \033[0m after to reset color. Example: echo -e "\033[31mRed Text\033[0m"
Click to reveal answer
beginner
What does the ANSI escape code \033[0m do?
It resets all text formatting and colors back to the terminal's default settings.
Click to reveal answer
beginner
Name three common text colors you can use with ANSI escape codes.
Red (31), Green (32), Yellow (33) are common colors used in ANSI escape codes.
Click to reveal answer
beginner
Why is it important to reset color after printing colored text in bash?
If you don't reset, the terminal will keep using the color for all following text, which can cause confusion or messy output.
Click to reveal answer
Which ANSI escape code sets the text color to green?
✗ Incorrect
The code \033[32m sets the text color to green.
What does the escape sequence \033[0m do?
✗ Incorrect
The sequence \033[0m resets all text formatting and colors.
How do you enable interpretation of backslash escapes in echo command?
✗ Incorrect
The option -e enables interpretation of backslash escapes like \033.
Which color code corresponds to yellow text in ANSI escape codes?
✗ Incorrect
The code 33 sets the text color to yellow.
What happens if you forget to reset color after colored output?
✗ Incorrect
The terminal continues using the last set color, affecting all following text.
Explain how to print colored text in bash using ANSI escape codes.
Think about how to start color, print text, then reset.
You got /3 concepts.
List three common ANSI color codes and their colors.
Remember the basic colors used in terminal output.
You got /3 concepts.