Last active
January 25, 2024 11:20
-
-
Save fjrti/0e75ff0c1e0dae722324727c425c569b to your computer and use it in GitHub Desktop.
Saved from https://www.digitalocean.com/community/questions/how-to-change-the-color-of-the-output-in-linux-bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the color variable | |
green='\033[0;32m' | |
# Clear the color after that | |
clear='\033[0m' | |
printf "The script was executed ${green}successfully${clear}!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Color variables | |
red='\033[0;31m' | |
green='\033[0;32m' | |
yellow='\033[0;33m' | |
blue='\033[0;34m' | |
magenta='\033[0;35m' | |
cyan='\033[0;36m' | |
# Clear the color after that | |
clear='\033[0m' | |
# Examples | |
echo -e "The color is: ${red}red${clear}!" | |
echo -e "The color is: ${green}green${clear}!" | |
echo -e "The color is: ${yellow}yellow${clear}!" | |
echo -e "The color is: ${blue}blue${clear}!" | |
echo -e "The color is: ${magenta}magenta${clear}!" | |
echo -e "The color is: ${cyan}cyan${clear}!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment