Color text on shell programming


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Color text on shell programming
# 1  
Old 09-16-2013
Color text on shell programming

hello
i need the main reference for color code on shell programing
i know a few color like:

Code:
RED='\033[01;31m'
GREEN='\033[01;32m'
WHITE='\033[01;1;37m'
DYELLOW='\033[01;33m'
YELLOW='\033[01;1;33m'

# 2  
Old 09-16-2013
Colours

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 09-16-2013
And if your terminal support 256 colors, try this script:
Code:
#!/bin/bash
#
# generates an 8 bit color table (256 colors) for reference,
# using the ANSI CSI+SGR \e[48;5;${val}m for background and
# \e[38;5;${val}m for text (see "ANSI Code" on Wikipedia)
#
echo -en "\n   +  "
for i in {0..35}; do
        printf "%2b " $i
done
printf "\n\n %3b  " 0
for i in {0..15}; do
echo -en "\e[48;5;${i}m  \e[m "
done

for i in {0..6}; do
        i=$((i*36 +16))
        printf "\n\n %3b  " $i
        for j in {0..35}; do
                val=$((i+j))
                echo -en "\e[48;5;${val}m  \e[m "
        done
done
echo -e "\n"

This User Gave Thanks to Jotne For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

2. Shell Programming and Scripting

Change text color in Korn shell to highlight Error

Hi this is my first post, so forgive me if what I'm requesting doesn't make sense. I'm connecting into a Unix server via SSH and using a Korn Shell (#!/bin/ksh). The Unix server has Oracle 11g installed on it and there are a number of scripts already setup to query the Oracle database to perform... (2 Replies)
Discussion started by: KeithJ
2 Replies

3. AIX

How to color text and mail

I want to color the text and bold the text and mail these text. input: hi..(in bold) good morning (in blue color) and mail these as in color and bold :wall: (1 Reply)
Discussion started by: AhmedLakadkutta
1 Replies

4. Programming

changing text color in c

I'm writing my own Unix ls command in c and I was wondering if anyone knows how to or can point me to a tutorial that shows me how to change the text color of the filename depending on if it's a directory, regular file, linked file, etc..., like the real ls command does? Thanks. (4 Replies)
Discussion started by: snag49ers
4 Replies

5. Red Hat

New Background and Text Color

Hi. How do I change the background color and text in Fedora. I did find the set_color -b command. Thanks (1 Reply)
Discussion started by: Ccccc
1 Replies

6. Shell Programming and Scripting

text color

Hi all I have a file contains columns showing figures as below : Input file A B C D 50 60 90 E 100 20 53 F 30 40 70 G 25 27 45 I want to color the value above or equal 90 by red and to be shown as below output file... (5 Replies)
Discussion started by: Bluetoot
5 Replies

7. Shell Programming and Scripting

pls help me !! about text database shell programming

my teacher assigned me an assignment about text database shell programming but I don't know anything about that. here is about problem. I must submit this assignment to my teacher before 3 August. contact me at **deleted**, thank you Given a text database file for student registration name... (2 Replies)
Discussion started by: sunattha
2 Replies

8. UNIX for Dummies Questions & Answers

To Read a text file using shell Programming

Hello! I need to read a text file containing certains rows and columns!The following is a sample file with only three rows! 01:41:30:00:05:51 OFF 48506649K 5769415 63494357K 01:41:30:00:05:65 ON 4493546K 27266552 5880264K 01:41:30:00:05:78 OFF 614556K 89121 47291K... (1 Reply)
Discussion started by: sandytul
1 Replies
Login or Register to Ask a Question