Bash colors: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Use colors within scripts <pre> for (( i = 30; i < 38; i++ )); do echo -e "\033[0;"$i"m Normal: (0;$i); \033[1;"$i"m Light: (1;$i)"; done </pre> Within the script: Where numb...") |
mNo edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
<metadesc>Examples of using colors in bash scripts.</metadesc> | |||
Use colors within scripts | Use colors within scripts | ||
Line 9: | Line 10: | ||
echo -e "\033[0;${NUMBER}mYOUR STRING YOU WANT IN COLOR" | echo -e "\033[0;${NUMBER}mYOUR STRING YOU WANT IN COLOR" | ||
</pre> | </pre> | ||
Reset your color after messing with it: | |||
[https://unix.stackexchange.com/questions/412900/reset-the-color-of-the-output-after-my-command-in-bash-shell reset color after command changes it] | |||
<pre> | |||
echo -e "\033[0m" | |||
</pre> | |||
[[Category:Bash]] | [[Category:Bash]] |
Latest revision as of 13:57, 25 April 2024
Use colors within scripts
for (( i = 30; i < 38; i++ )); do echo -e "\033[0;"$i"m Normal: (0;$i); \033[1;"$i"m Light: (1;$i)"; done
Within the script: Where number is defined from the output above
echo -e "\033[0;${NUMBER}mYOUR STRING YOU WANT IN COLOR"
Reset your color after messing with it: reset color after command changes it
echo -e "\033[0m"