Operating System - HP-UX
1834200 Members
2424 Online
110066 Solutions
New Discussion

how to generate color in ksh93 or ksh like bash shell

 
SOLVED
Go to solution
ashanabey
Advisor

how to generate color in ksh93 or ksh like bash shell

Hi all,

my requirement is to generate color in ksh like
bash shell.In my program I need to use like
below example.

Lan Card Reset test.....[FAIL] in red.

can any one help how generate "[FAIL] in red"

Regards

Ashan
legend the heart and lend the hand
4 REPLIES 4
curt larson_1
Honored Contributor
Solution

Re: how to generate color in ksh93 or ksh like bash shell

ashanabey
Advisor

Re: how to generate color in ksh93 or ksh like bash shell

Hi

Thanks for the info,How do i bilnk the
words..? using tput

Regs,
Ashan
legend the heart and lend the hand
Doug Burton
Respected Contributor

Re: how to generate color in ksh93 or ksh like bash shell

You can get some basic looking colors with your prompt (in a dtterm window) doing this:

export NOEUD=`hostname`
if [[ $TERM = dtterm ]]
then
PS1="$(echo "\\033[40m\\033[33m")"'$LOGNAME'@$(hostname)"-$(echo "\\033[36m")"'$PWD'"$(echo "\\033[0m") : "
#export PS1="$(echo "\\033[40m\\033[33m")$LOGNAME@$(hostname):$(echo "\\033[0m") "
else
PS1='$LOGNAME@$NOEUD-$PWD'" : "
fi

or fooling around with output from a command (see "Color_LL" attached).
Doug Burton
Respected Contributor

Re: how to generate color in ksh93 or ksh like bash shell

Forgot to add this file I put together some time ago. I had tried diff color changes to see what would happen. The results are in the attached file.