Date: Thu, 15 May 2008 09:33:53 +0530 From: "N. Raghavendra" <raghu@mri.ernet.in> To: "Montag" <montag@activeattack.com> Cc: freebsd questions <freebsd-questions@freebsd.org> Subject: Re: Configuring Bash Message-ID: <86tzh0usba.fsf@riemann.mri.ernet.in> In-Reply-To: <1210810823.5782.1253224263@webmail.messagingengine.com> (montag@activeattack.com's message of "Wed, 14 May 2008 19:20:23 -0500") References: <1210810823.5782.1253224263@webmail.messagingengine.com>
next in thread | previous in thread | raw e-mail | index | archive | help
At 2008-05-14T19:20:23-05:00, Montag wrote:
> I've got the following in the .bash_profile of a basic user account:
>
> # set prompt [user@host--/dir] $ (# for root)
> PS1 = ' [\u@\h--\w] '
> case `id -u` in
> 0) PS1='${PS1} # ';; # root
> *) PS1='${PS1} $ ';; # everyone else
I don't use `bash' much, but that `case' expression is probably
unnecessary. According to bash(1) [section on "Prompting"], the
special character `$' can be used in prompt-strings:
"\$ if the effective UID is 0, a #, otherwise a $"
So, something like
export PS1="[\u@\h--\w]\$ "
in `~/.bashrc' should produce the prompt you want.
Raghavendra.
--
N. Raghavendra <raghu@mri.ernet.in> | http://www.retrotexts.net/
Harish-Chandra Research Institute | http://www.mri.ernet.in/
See message headers for contact and OpenPGP information.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86tzh0usba.fsf>
