Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One quick and dirty solution is to ignore what the author(s) of /etc/bashrc are recommending:

Just place your customized PS1 in /etc/bashrc, and if you like, have place another customization as ~/.bashrc. Works just fine, including title bar (where in my case it shows PS1).

Example for /etc/bashrc:

if [ $(id -u) -eq 0 ];
then
PS1="\[\033[01;31m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\w #\[\033[00m\] "
else
PS1="\[\033[01;32m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\W $\[\033[00m\] "
fi

Example for ~/.bashrc

PS1="\[\033[01;32m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\w $\[\033[00m\] "

One quick and dirty solution is to ignore what the author(s) of /etc/bashrc are recommending:

Just place your customized PS1 in /etc/bashrc, and if you like, have place another customization as ~/.bashrc. Works just fine, including title bar (where in my case it shows PS1).

Example for /etc/bashrc:

if [ $(id -u) -eq 0 ];
then
PS1="\[\033[01;31m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\w #\[\033[00m\] "
else
PS1="\[\033[01;32m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\W $\[\033[00m\] "
fi

Example for ~/.bashrc

PS1="\[\033[01;32m\]\u@\h:\[\033[00m\] \[\033[01;34m\]\w $\[\033[00m\] "