Bash

October 15th, 2009 by KingTarquin Leave a reply »

standard_rhel

I got bored of looking at the same terminal screen day in, day out. The standard output’s are boring, and are the same on most distributions.  The image on the right shows how they should look, boring and not very exciting. After some tweeking and some minor editing, oh, and a lot of reading, Using the following bash script, I have created something unique, and something I like.

# If id command returns zero, you’ve root access.
if [ $(id -u) -eq 0 ];
then # you are root, set red colour prompt
 PS1="\e[35;1m(\d \t\e[31;1m \u@\h:\w ) $\e[0m \n    "
else # normal
 PS1="\e[35;1m(\d \t\e[34;1m \u@\h:\w ) $\e[0m \n    "
fi

All that differs between the two outputs, is the colour of the user’s terminal. Just to help me see quickly if I am putting a command into the root terminal. After appending this script to /etc/bashrc, I had found what I liked..

bash_root

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • MySpace
  • StumbleUpon
  • Twitter
Advertisement

Leave a Reply