Add color to the Unix PS1 prompt
- Posted by Arjun Raja
- On July 10, 2009
- 2 Comments
This has been tested on an AIX box –
To customize the colour of the message on login by updating the profile called on login for a user into a unix machine update the profile with the following –
Red=”33[31m”
RedBG=”33[41m”
LightRed=”33[1;31m”
Green=”33[32m”
GreenBG=”33[42m”
Yellow=”33[33m”
YellowBG=”33[43m”
Blue=”33[34m”
BlueBG=”33[44m”
Purple=”33[35m”
PurpleBG=”33[45m”
BoldON=”33[1m”
BoldOFF=”33[22m”
NC=”33[0m” # No Color
MESSAGE=`echo “$Green$BoldON[DEV]$BoldOFF$NC”`
export MESSAGE
Bold=$(tput smso)
Normal=$(tput sgr0)
export PS1=”$MESSAGE \${ORACLE_SID}:\$PWD > ”
This entry will show a message which points to the machine being a DEV machine and in Green –
Example – The DEV below will show up in colour GREEN –
[DEV] ofsad1:/u01/ofsad1
2 Comments