Colors For Bash Scripts

Go down

Colors For Bash Scripts

Post by jamied_uk on 2nd May 2018, 13:07

Colors For Bash



Vid



Code:
#!/bin/bash
#
#
#
#
#
#
# printf "I ${RED}love${NC} Stack Overflow\n" # Black        0;30     Dark Gray     1;30
RED='\033[0;31m'
NC='\033[0m' # No Color
#
#


#
#
text="Website Here!"
printf "I ${RED}love${NC} $text\n"


Full Colors:
Code:
#!/bin/bash
#
#
# stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
#
#Black        0;30     Dark Gray     1;30
#Red          0;31     Light Red    1;31
#Green        0;32     Light Green   1;32
#Brown/Orange 0;33     Yellow        1;33
#Blue         0;34     Light Blue    1;34
#Purple       0;35     Light Purple  1;35
#Cyan         0;36     Light Cyan    1;36
#Light Gray   0;37     White         1;37
#
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "I ${RED}love${NC} Stack Overflow\n"
# Black        0;30     Dark Gray     1;30
#Red          0;31     #Light Red    1;31
#Green        0;32     Light Green   1;32
#Brown/Orange 0;33     Yellow        1;33
#Blue         0;34     Light Blue    1;34
#Purple       0;35     Light Purple  1;35
#Cyan         0;36     Light Cyan    1;36
#Light Gray   0;37     White         1;37
#
# And then use them like this in your script:
#
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "I ${RED}love${NC} Stack Overflow\n"
avatar
jamied_uk
Admin

Posts : 2408
Join date : 2010-05-09
Age : 35
Location : UK

http://address-shortner.co.uk

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum