tech.gate.io blog

Unix Color Terminal

This will describe how to render coloured output in Unix Shells.

As you probably know PS1 is the shell variable that describes the output in front of your command line. I will demonstrate on this variable how it's done, because in our environment we are using it to display the most important variables on a system (e.g. Horc instance, User, ...)

Here is how to highlight them:

FBLUE="\0033[34;1m"
NOCOL="\0033[0m"
FGREEN="\0033[32;1m"
FRED="\0033[31;1m"

PS1=`echo $FRED`"$LOGNAME@$(hostname) "`echo $FBLUE`"Blue text"`echo $FGREEN`"$anothervariable"`echo $NOCOL`" \$PWD #"

Now, that's cool ;-)

of course you could also:

echo "\0033[34;1m" BlueText; echo "\0033[0m"

 


13 comments


private message
A good many vlaaulbes you've given me.



private message
ultram shwuoz ultram zjen



private message
köpa viagra online vzkg viagra :-(((




private message
lowest prices for tramadol online 558424 cialis jjd


Page: 1/3  [Next]
1  2  3 

Post new comment

Anti-Bot verification code image
Try another code

Feeds List