The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
How to: Parse text string into variables using Korn shell shew01 Shell Programming and Scripting 7 05-23-2008 10:01 AM
changing the colors of nedit eynkesef UNIX for Dummies Questions & Answers 0 09-10-2006 04:39 AM
Changing a CSV file in Korn shell riteshm Shell Programming and Scripting 2 02-27-2006 08:54 PM
Help with Korn Shell script heprox AIX 1 12-19-2005 02:04 PM
korn shell script pavan_test UNIX for Dummies Questions & Answers 1 10-26-2005 01:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-13-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
Changing korn shell script text Menu colors?

Is it possible to change the color of text in a korn shell script Menu?

I can change the color of session text through my telnet client but I want to be able to change color text in the Korn shell menu to highlight certain items.
  #2 (permalink)  
Old 12-13-2001
PxT's Avatar
PxT PxT is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
Assuming your terminal supports ANSI colors, it is quite easy. You just need to add certain echo statements to achieve certain colors.

The syntax is: echo "^[[#m<text>"

Where the the "^[" character is produced by hitting ctrl-v and then escape and # is substituted with a number depending on the effect you want the second "[" and the "m" are literal characters. Here's an excerpt from some C code listing the various colors (because I'm too lazy to retype it in a different format):

Code:
/* foreground colors */
#define AFC_BLACK           30
#define AFC_RED             31
#define AFC_GREEN           32
#define AFC_YELLOW          33
#define AFC_BLUE            34
#define AFC_MAGENTA         35
#define AFC_CYAN            36
#define AFC_WHITE           37

/* ansi background colors */
#define ABC_BLACK           40
#define ABC_RED             41
#define ABC_GREEN           42
#define ABC_YELLOW          43
#define ABC_BLUE            44
#define ABC_MAGENTA         45
#define ABC_CYAN            46
#define ABC_WHITE           47


/* ansi modes */
#define AM_NORMAL               0         
#define AM_BOLD                 1
#define AM_LOWINTESITY          2
#define AM_ITALIC               3
#define AM_UNDERLINE            4
#define AM_BLINK                5
#define AM_RAPIDBLINK           6
#define AM_REVERSE              7
#define AM_INVISIBLE            8
You can combine the modes, so to print the word "hello" in yellow text on a blue background and then return to normal you would use:

echo "^[[33m^[[44mhello^[[0m"
  #3 (permalink)  
Old 12-13-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
What about chaning output text?

Thanks for the reply. That works great with echo, but is there also a way to change the output text of a command to a alternate color also?
  #4 (permalink)  
Old 12-21-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
Changing color with other commands?

Is it possible to change the color output on other commands like.

banner "^[[31m^[[44m Hello ^[[0m"
  #5 (permalink)  
Old 12-24-2001
Prafulla Prafulla is offline
Registered User
  
 

Join Date: Jul 2001
Location: India
Posts: 57
Unhappy hi

Hi
the text colors with banner comand is not coming....
what about the anci mode in the last field how to get blinking text with colours.....

please suggest
prafulla
  #6 (permalink)  
Old 12-28-2001
darthur darthur is offline
Registered User
  
 

Join Date: Dec 2001
Location: Overland Patrk
Posts: 62
prafulla,

Good question. Suggestion on blinking text colours anyone?
  #7 (permalink)  
Old 01-20-2002
Shakey21
Guest
  
 

Posts: n/a
Bits: 0 [Banking]
what else does this work for?

I figure that this must be the ANSI standard for colours for ANSI terminals, so it will work for perl scripts, bash scripts and so on?

It seems to on my terminal, however I am a little skeptic with these things in a live environment.

Thanks
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0