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"

 


38 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
Nice site you have there I've been hinvag a bit of success lately using yourkeyword home', so in your case you could try cleaning home' if you try and put too many keywords in it looks a bit spammy imo. The company name could just about work too. It's definately something to consider, as it's a link that appears on every page and possibly more importantly, towards the top of the page too this will be next post I think content source ordering.


Page: 1/5  [Next]
1  2  3  4  5 

Post new comment

Anti-Bot verification code image
Try another code

Last blog post comments

  1. xymon netapp vfiler quota monitoring: rvksjfq sjmgafs 01:26 CEST
  2. Use Windows as router / NAT traffic: vnvrfihp muygzxbi Sat 19 of May, 2012 16:18 CEST
  3. mount nfs v3 share under Solaris 10: kdvwtux xqowacnm Sat 19 of May, 2012 04:21 CEST
  4. Unix Color Terminal: cbeusw ejbpsnr Sat 19 of May, 2012 01:29 CEST
  5. AIX: Get PVID directly from hdisk using od: buy penis enlargement penis_enlargement Fri 18 of May, 2012 15:14 CEST
  6. AIX: Get PVID directly from hdisk using od: risperdal risperdal Fri 18 of May, 2012 13:00 CEST
  7. AIX: Get PVID directly from hdisk using od: cheap phen375 phen375 Wed 16 of May, 2012 18:30 CEST
  8. AIX: Get PVID directly from hdisk using od: Good info Pharmk935 Mon 14 of May, 2012 23:06 CEST
  9. Unix Color Terminal: Good info Pharmd119 Sun 13 of May, 2012 15:49 CEST
  10. Test network throughput without disk or cpu distortion: Good info Pharmd585 Sun 13 of May, 2012 06:01 CEST

Feeds List