ksh - how to echo something in color and bold


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ksh - how to echo something in color and bold
# 1  
Old 03-17-2008
ksh - how to echo something in color and bold

Hi all,

I was to echo Hi in Red and Bold ; and echo There is in Green and bold

I got bold to working using tput bold but i am having hard time getting the color.

Any help is appreciated,
jak
# 2  
Old 03-18-2008
echo "\033[1;31mhi\033[m"
echo "\033[1;32mthere \033[m"
# 3  
Old 03-18-2008
What exactly change text colour and/or bold/offbold?

red: echo "\033[1;31mhi\033[m"
green: echo "\033[1;32mhi\033[m"
yellow: echo "\033[1;33mhi\033[m"
blue: echo "\033[1;34mhi\033[m"

Franci

Last edited by frajer; 03-18-2008 at 06:25 AM..
# 4  
Old 03-19-2008
ksh - how to echo something in color and bold

Here are the color codes and others:

LF="\n"; CR="\r"
INVT="\033[7m"; NORM="\033[0m"; BOLD="\033[1m"; BLINK="\033[5m"
#UNDR="\033[2m\033[4m"; EOL="\033[0K"; EOD="\033[0J"
UNDR="\033[4m"; EOL="\033[0K"; EOD="\033[0J"
SOD="\033[1;1f"; CUR_UP="\033[1A"; CUR_DN="\033[1B"; CUR_LEFT="\033[1D"
CUR_RIGHT="\033[1C"

#-- ANSI code
SCR_HOME="\033[0;0H" #-- Home of the display

BLACK_F="\033[30m"; BLACK_B="\033[40m"
RED_F="\033[31m"; RED_B="\033[41m"
GREEN_F="\033[32m"; GREEN_B="\033[42m"
YELLOW_F="\033[33m"; YELLOW_B="\033[43m"
BLUE_F="\033[34m"; BLUE_B="\033[44m"
MAGENTA_F="\033[35m"; MAGENTA_B="\033[45m"
CYAN_F="\033[36m"; CYAN_B="\033[46m"
WHITE_F="\033[37m"; WHITE_B="\033[47m"

Example: bold
echo "${BOLD}Bold test ${NORM}"

-Ramesh
# 5  
Old 03-19-2008
Thanks for all your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Change text color from echo command?

I have a bash script that starts and stops a game among other things through in.fifo and out.fifo In game the text comes out gray . Kinda hard to see in game window . I would like to change it to purple and maybe capitalize it. #!/bin/bash #nwservctl.sh cd... (5 Replies)
Discussion started by: 222222quick
5 Replies

2. UNIX for Dummies Questions & Answers

How to change color when doing echo in tcsh?

Is it possible to change the color when doing an echo? Example, having the following command print in dark blue. echo "Hello" ---------- Post updated at 11:50 AM ---------- Previous update was at 10:25 AM ---------- Just figured out how to do it (2 Replies)
Discussion started by: kristinu
2 Replies

3. Shell Programming and Scripting

Color Underline and Bold letter in shell script

Hi All, This is my first port..... I am using AIX 5L, installed 10g database. On daily basis we takes rman backup. This backup status info strored in a log file. I write a script to know the status of back means I will fire this script and this script will send a mail to me. #!/bin/bash... (16 Replies)
Discussion started by: mcagaurav
16 Replies

4. Shell Programming and Scripting

Color on echo output does not work

Hi, When I run: echo "\033I see hi in color, but if I run this color is not shown, why? (echo "\033Thanks Israel. ---------- Post updated at 05:17 AM ---------- Previous update was at 04:43 AM ---------- DONE!! I had to run more -v. Thanks (4 Replies)
Discussion started by: iga3725
4 Replies

5. Shell Programming and Scripting

give some color to a word on echo output

Hi Supposed this text output: How can I show $HOSTNAME in other color than blank? :-) KSH on AIX (4 Replies)
Discussion started by: iga3725
4 Replies

6. UNIX for Dummies Questions & Answers

How to bold, blink, italicise words using echo command?

Hello Everyone. I am trying to bold, blink, italicise words using echo command. As per the research I did, it says to use the following escape code to get the effects. #!/bin/bash clear echo -e "\033 However when I am compiling I am not getting the desired effect. Can anyone... (7 Replies)
Discussion started by: grc
7 Replies

7. Shell Programming and Scripting

color,bold

hi friend , I am generating a csv file i,e output file E104|0|06/04/1994|The values E005 and E001 are not equal. E106|0|01/09/1993|The values E001 and E002 are not equal. E106|0|01/09/1993|The values E003 and E002 are not equal. E108|0|02/30/1995|The values R001 and E001 are not equal.... (0 Replies)
Discussion started by: charandevu
0 Replies
Login or Register to Ask a Question