The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
change directory using shell script laxmi Shell Programming and Scripting 0 01-17-2008 04:12 AM
How to change font and colour in mail sent from Unix yogichavan HP-UX 3 07-09-2007 03:41 AM
#!/bin/sh script is in white colour MarGur Shell Programming and Scripting 1 05-11-2007 02:01 PM
How to change the font colour in unix ? sars Shell Programming and Scripting 3 12-04-2006 07:20 AM
change user through shell script raviraushanjha UNIX for Dummies Questions & Answers 0 12-12-2005 12:11 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-23-2005
Registered User
 

Join Date: Aug 2005
Posts: 13
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.
Reply With Quote
Forum Sponsor
  #2  
Old 08-23-2005
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
So you like color, see this
... and this!
Reply With Quote
  #3  
Old 08-29-2005
Registered User
 

Join Date: Aug 2005
Posts: 13
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.
Reply With Quote
  #4  
Old 08-29-2005
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
Well yeah!
It's easy as abc 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
Reply With Quote
  #5  
Old 08-29-2005
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
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
Reply With Quote
  #6  
Old 08-29-2005
Registered User
 

Join Date: Aug 2005
Posts: 13
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.
Reply With Quote
  #7  
Old 08-30-2005
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
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
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 10:08 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0