extra-prompt.sh

Bruce Dubbs bruce.dubbs at gmail.com
Sat Jul 28 09:21:05 PDT 2007


David Jensen wrote:
> Moving to dev. 

> Ag. D. Hatzimanikas wrote:
>> Does this prompt (in /etc/profile) looks good to you? (it was suggested by 
>> David Jensen)
>>
>> if [[ ${EUID} == 0 ]] ; then
>> 	PS1='\[\e[1;31m\]\u [ \[\e[00m\]\w \[\e[1;31m\]]\$ \[\e[00m\]'
>>         else
>> 	PS1='\[\e[1;32m\]\u [ \[\e[00m\]\w \[\e[1;32m\]]\$ \[\e[00m\]'
>> fi

This is too cryptic.  Use:

NORMAL="\[\033[0;39m\]"
RED="\[\033[1;31m\]"
GREEN="\[\033[1;32m\]"

if [[ ${EUID} == 0 ]] ; then
  PS1="$RED\u [ $NORMAL\w$RED ]\$ $NORMAL"
else
  PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
fi

  -- Bruce



More information about the blfs-dev mailing list