Color output (ANSI escape codes)
📖 Scenario: You want to make your terminal messages more colorful to catch attention or show status clearly. Using ANSI escape codes, you can add colors to your text output in the terminal.
🎯 Goal: Create a bash script that prints a message in red color using ANSI escape codes.
📋 What You'll Learn
Create a variable holding the ANSI escape code for red color
Create a variable holding the ANSI escape code to reset color
Use these variables to print the message 'Error: File not found!' in red color
Print the message so that the terminal color resets after the message
💡 Why This Matters
🌍 Real World
Colored terminal output helps highlight errors, warnings, or success messages making scripts easier to read and debug.
💼 Career
Many automation and scripting jobs require clear terminal output. Knowing how to add color improves script usability and professionalism.
Progress0 / 4 steps