You can use these ANSI escape codes:

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:

#    .---------- constant part!
#    vvvv vvvv-- the code from above
RED='\033[0;31m'
NC='\033[0m' # No Color
printf "I ${RED}love${NC} Stack Overflow\n"

which prints love in red.

From @james-lim's comment, if you are using the echo command, be sure to use the -e flag to allow backslash escapes.

# Continued from above example
echo -e "I ${RED}love${NC} Stack Overflow"

(don't add "\n" when using echo unless you want to add additional empty line)

Save PL/pgSQL output from PostgreSQL to a CSV file

str_word_count() function display Arabic language properly

How To Change API SDK Level In Android Studio

light ,echo ,red ,to ,the ,you ,{nc} stack ,{red}love {nc} ,i {red}love ,36 light ,from above

مشخصات

تبلیغات

آخرین ارسال ها

برترین جستجو ها

آخرین جستجو ها

در خیالِ آسمان اموزش و دانلود کتاب ها Anwinux - انوینوکس وبلاگ شخصی عارف قهرمانزاده کمیته بازی ها و ورزش های الکترونیک شهرستان بابلسر بررسی شرکت های اجاره ماشین در کیش پت شاپ کرج سربلند بانیروهای جوان انقلابی محصولات آرایشی و بهداشتی باتینوک سامانه پیامک صوتی