extra-prompt.sh

David Jensen djensen at inebraska.com
Sun Jul 29 11:56:56 PDT 2007


Bruce Dubbs wrote:
much snipped!
>> Reviewing this thread 
>> http://linuxfromscratch.org/pipermail/blfs-dev/2007-March/016818.html
>> it seems PS1 should not be exported, no decision was reached
>>     
>
> It should not be exported because it does no good.  PS1 is reset for
> each invocation.  From the bash man page:
>
> "An  interactive  shell is one started without non-option arguments and
> without the -c option whose standard input and error are both connected
> to terminals (as  determined by  isatty(3)),  or  one started with the
> -i option.  PS1 is set and $- includes i if bash is interactive,
> allowing a shell script or a startup file to test this state."
>
>   
Thanks Bruce.


I suggest.
1).
    Lose /etc/extra-prompt.sh.
2).
    Lose export for PS1.
3).
    Use:

NORMAL="\[\e[0m\]"
RED="\[\e[1;31m\]"
GREEN="\[\e[1;32m\]"
if [[ ${EUID} == 0 ]] ; then
  PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
else
  PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
fi

---
David Jensen





More information about the blfs-dev mailing list