Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2005 12:37:33 +0200
From:      albi <albi@scii.nl>
To:        Gerard Seibert <gerard-seibert@rcn.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Bash: Setting Prompt
Message-ID:  <20050518123733.44e79cd5.albi@scii.nl>
In-Reply-To: <Pine.WNT.4.61.0505180625030.2400@Treneq>
References:  <Pine.WNT.4.61.0505180625030.2400@Treneq>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 18 May 2005 06:26:53 -0400 (Eastern Standard Time)
Gerard Seibert <gerard-seibert@rcn.com> wrote:

> PS1="\u@\h \w "
> case 'id -u' in
>  	0) PS1="${PS1}# ";;
>  	*) PS1="${PS1}$ ";;
> esac
--- cut ---
> It is suppose to set the prompt to display the 'user@host' and the working 
> directory with a '#' for root and '$' for user. Everything works except 
> for the '#' and '$' symbols. The '$' symbol is always displayed.

this is what i use :

case $UID in
                0) PS1="\[\033[1;31m\][ \u@\h:\w] #\[\033[0m\] ";;
                *) PS1="\[\033[2;36m\][ \u@\h:\w] $\[\033[0m\] ";;
        esac

you could use this and remove the colours if you like



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050518123733.44e79cd5.albi>