give some color to a word on echo output


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting give some color to a word on echo output
# 1  
Old 07-15-2010
give some color to a word on echo output

Hi

Supposed this text output:

Quote:
print " ************************************"
print " ******* RBAC en $HOSTNAME *********"
print " ** Administracion y Configuracion **"
print " ************************************"
echo
How can I show $HOSTNAME in other color than blank? :-)

KSH on AIX
# 2  
Old 07-15-2010
Hello,

You can change colour in ksh. Kindly refer below link.

Change colour codes
# 3  
Old 07-15-2010
Try this
Code:
echo " ******* RBAC en `tput smso` $HOSTNAME `tput rmso`*********"

# 4  
Old 07-15-2010
Nice hari.. thanks!
# 5  
Old 07-15-2010
Hi iga3725,

Just Refer this link. You will find lot of options and ways to do it.


Bash Prompt HOWTO: ANSI Escape Sequences: Colours and Cursor Movement
Login or Register to Ask a Question

Previous Thread | Next Thread

9 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. Shell Programming and Scripting

How to give color and space?

I have write one scripts,i want give the color for only one line and give the space for 2line. how to give the color and space of line.... (7 Replies)
Discussion started by: rajivgandhi
7 Replies

3. 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

4. UNIX for Dummies Questions & Answers

What will echo $$ command give

Hi I tried giving the following command echo $$a I got an output like 32178a Can some one please explain why echo $$ is returning 32178 Thanks in advance (6 Replies)
Discussion started by: Sri3001
6 Replies

5. Shell Programming and Scripting

Give user 5 chances to guess my favorite color

I wrote a script to give a user 5 guesses on what is my favorite color but I it doesn't work. I've only been scripting for a couple weeks and need some help it seems simple but how do I give the user 5 guesses? (3 Replies)
Discussion started by: noob
3 Replies

6. 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

7. UNIX for Dummies Questions & Answers

Using SED to change a specific word's color?

Ok so all i'm trying to do here is output a file and change the color of a specific word. I can't use grep with color because I need all lines of the file not just lines that match the pattern. I can get this substitution to work but when it displays it shows exactly what i'm putting it rather... (14 Replies)
Discussion started by: MrEddy
14 Replies

8. Shell Programming and Scripting

.bashrc/PS1 command color different color to command output

I have been configuring my .bashrc PS1 to be displayed with some nice colors and in a format that I like, however there is one thing that I cannot figure out (or know if it's even possible). my PS1 line is as follows: export PS1='\\u\@\\h\:\\w\n\\$ \'This makes the command and command output... (0 Replies)
Discussion started by: jelloir
0 Replies

9. Shell Programming and Scripting

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 (4 Replies)
Discussion started by: jakSun8
4 Replies
Login or Register to Ask a Question