02-07-2008
printing color/bold
To change the color from the script or the command line, you execute command in the following format: echo "<esc>[<color>m <string>", where
<esc> is an escape character (Ctrl+V), followed by a bracket [, followed by a color code (see below), followed by letter m, followed by a string to print. Color codes for foreground are as follows: 30 (black), 31 (red), 32 (green), 33 (yellow), 34 (blue), 35 (magenta), 36 (cyan), and 37 (gray). For backgrounds color codes are the same, except instead of 3, they start with 4. They can be mixed and matched. Bold is 1, underlined is 4. For csh shell, I actually had to use vi editor and enter Ctrl+V to have that character recorded, bracket follows right after, letter m is necessary after the color code to end the escape sequence. In other shells, \033 or \E can work instead of using Ctrl+V. Here is a complete example:
echo "<esc>[34m I am in blue" or echo "<esc>[1m I am in bold". I hope this helps.
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello all I am a new linux user (Redhat 7) and I am trying to learn how to operate the system. I have a couple problems one the font size for all windows withing the OS are too small and even though I found a couple places to configure font size I can't find where to change the font size for the... (2 Replies)
Discussion started by: elhefe
2 Replies
2. Solaris
hi all ,
i was just wondering if i can specify the font size when i am printing from solaris .
i am using solaris 9 and hp laserjet 1230 .
i dont want to change the global variable for the printer driver .
i just want to print a file with small font and the others with normal fonts .
... (1 Reply)
Discussion started by: ppass
1 Replies
3. AIX
I need to be able to change the font, pitch, and orientation when printing a text flat file. Any suggestions appreciated. (2 Replies)
Discussion started by: mad_dog
2 Replies
4. UNIX for Dummies Questions & Answers
can any one tell me how to set the font size in unix? (14 Replies)
Discussion started by: sachin.gangadha
14 Replies
5. Shell Programming and Scripting
Hi,
I am new to shell script. Can you please tell me, whether can we specify font type and color in a shell script? If so, how to do this?
Thanks in advance. (4 Replies)
Discussion started by: Vani_Govind
4 Replies
6. Solaris
Hello,
It is not related to scripting or unix command but it is related to Solaris environment setup. I'm a web developer, in my web application (J2EE using WebLogic 8.1) currently it's running in Windows. We are planning to have Disaster Server in Solaris host. In my application, we are... (1 Reply)
Discussion started by: luckybalaji
1 Replies
7. Shell Programming and Scripting
Hi All,
Please can someone advise on how to change the font size of the output of a shell script.
Best Regards,
Shazin (2 Replies)
Discussion started by: Shazin
2 Replies
8. UNIX for Dummies Questions & Answers
Please mention "How to increase font size for text to type commands in CYGWIN " ? (2 Replies)
Discussion started by: adirajup
2 Replies
9. Red Hat
Hi friends
I want increase font size in linux can anybody help me plese
Example:this is my in put
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00 18G 2.5G 14G 15% /
/dev/sda2 ... (1 Reply)
Discussion started by: vasuibm
1 Replies