Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing text colour on console

Status
Not open for further replies.

warburp

IS-IT--Management
Oct 27, 2003
44
GB
Hi

I have a series of korn scripts that provide menus for users on the system. I would like to be able to colour some of the text on some of the script options.

Does anyone know the command for this in korn shell? - can't seem to find anything on the web.

Thanks
 
See this FAQ in the awk forum : FAQ271-2920


Jean Pierre.
 
On Sco you can do:
Code:
:
GREEN=`setcolor green`
RED=`setcolor red`
BLUE_YELLOW=`setcolor blue yellow`
NORM=`setcolor -n`
:
echo "${GREEN}This is Green"
echo "${NORM}Back to Normal"
:

Another way is to hardcode the escape sequences like:
Code:
:
ESC='\033'
BLUE="${ESC}[34m"
:
echo "${BLUE}This is blue"
:
but it is valid only for ansi terminals.

or you can use the sgr terminfo or sa termcap entries if they are correctly defined:
Code:
:
BLUE=`tput sgr ... ...`
:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top