HOw to change the text colour through shell script?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers HOw to change the text colour through shell script?
# 1  
Old 08-23-2005
HOw to change the text colour through shell script?

Hi all,

I have written one script. If i run the script, particular text in that script needs to be displayed in color.how this could be done?any commands r there to change the colour of the text while running the script?

Ur help is appreciated !!!

Thanx in Advance,
Sona.
# 2  
Old 08-23-2005
So you like color, see this
... and this! Smilie
# 3  
Old 08-29-2005
HOw to change the text colour through shell script?

Hi,

thnx for ur reply.but what i want to know is how to use these colours implicitly. i dont want to hardcode the colours as like ^[[32m this in the script. is there any way to set this colour in a profile so that the text can be displayed in colour when the script is triggered.

Thanx in advance.
Sona.
This User Gave Thanks to Sona For This Post:
# 4  
Old 08-29-2005
Well yeah!
It's easy as abc Smilie u just have to store them in afile then source that file in your batches like this
Code:
[dot][space] file_with_color_def_inside

# 5  
Old 08-29-2005
Sure u can,
u just have to store them in afile then source that file in your batches like this
Code:
[dot][space] /full_path_file_with_color_def_inside
. /full_path_file_with_color_def_inside

# 6  
Old 08-30-2005
Hi,

can u give me one example for creating the profile and how can u use that in the script.

Also what i need exactly is like

for ex we have one script named test.ksh.
if i run the script it displays some lines like
aaaaaaaaaaaaa
bbbbbbbbbbbbb
ccccccccccccc
in that i want only the second line to be coloured and not all.

Pls guide me in doing this....

Sona.
# 7  
Old 08-30-2005
Download my cecho script - will show you the basics. Then it's just hardcoded in one place... chuck it in /usr/local/bin (if that's in your path) and then scripts can just call

cecho red This is in red

Cheers
ZB
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk and HTML with conditional text colour

Hello All, I am using awk with html options to format and send output to another file. Below command works fine, no issues. awk 'BEGIN{print "<table border="1" width="1000" >"} {print "<tr>";for(i=1;i<=NF;i++)print "<td>" $i"</td>";print "</tr>"} END {print "</table>"}' ${TMPLOGFILE1} >>... (0 Replies)
Discussion started by: jvmani_1
0 Replies

2. Shell Programming and Scripting

Colour code in shell script

Hello, I am trying to colour code a single word in whole line. Can you please help. I am able to colour code the whole line but not able to do only for single word Query) I want to echo below line and colur code red to word FAILED only. This server is FAILED in check. (2 Replies)
Discussion started by: saurabh84g
2 Replies

3. Shell Programming and Scripting

sed colour change

Hi, I am trying to write a script which will email a backup report from the server, The contents of the email will be: ---------------------- ---- -- ---- ----- ---- ------- ---- ------- ------- | | | | |Chnge|Wkng| | | | | | ... (6 Replies)
Discussion started by: Bdoydie
6 Replies

4. AIX

putty background colour change in vi editor

Hello, I have a problem with my putty session when i use the vi editor or when i do dbaccess on an Informix database. Suddenly the background and foreground colour of my terminal change and it makes it difficult for me to see whats on the screen. Why this is happening? Is there a way to keep... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

5. Programming

Cshell help with change colour in print

i want to ask how to change the colour of prompt message from use? and also how to change colour in printing........ i want to change it as blue colour and red colour, but i found many website still don't know how to do. how's the command is wrote? thz really!! (1 Reply)
Discussion started by: wendy1089
1 Replies

6. UNIX for Advanced & Expert Users

To change the colour of the content in email sent through unix

Hi I want to change the color of the email content sent through unix. I tried a lot and left in vain. I heard that it could be done by sending the email as HTML. But I don't how to do it. Can you all share your ideas? ~sakthifire (1 Reply)
Discussion started by: sakthifire
1 Replies

7. Shell Programming and Scripting

Changing text colour in bash

I am doing a basic script to check if services are disabled, and I was wondering how to change to colours for PASS and FAIL to green & red respectively. #!/usr/bin/bash clear TELNET=`svcs -a | grep telnet | awk '{print $1}'` if then RESULT=PASS else RESULT=FAIL fi... (3 Replies)
Discussion started by: detatchedd
3 Replies

8. HP-UX

How to change font and colour in mail sent from Unix

Dear All, We have following code to send mails from unix to users. We want to see few sentences of mail in bold font or to hightlight few lines in different colours. Could you please let me know how can we do it in function construct_body. ... (3 Replies)
Discussion started by: yogichavan
3 Replies

9. Shell Programming and Scripting

#!/bin/sh script is in white colour

Hello friends. I realize that my question is naive, but I really want to know, why one of my scripts is in white colour (I mean letters in the body are white) while 3 residuary are multicoloured. I'm asking because I have a little problem with this particular script. It's absolutely the same as... (1 Reply)
Discussion started by: MarGur
1 Replies

10. Shell Programming and Scripting

How to change the font colour in unix ?

Could you pls tell me how to change the font colour in unix ? What is the syntax ? (3 Replies)
Discussion started by: sars
3 Replies
Login or Register to Ask a Question