Configuring Bash
N. Raghavendra
raghu at mri.ernet.in
Thu May 15 04:10:41 UTC 2008
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 at 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 at mri.ernet.in> | http://www.retrotexts.net/
Harish-Chandra Research Institute | http://www.mri.ernet.in/
See message headers for contact and OpenPGP information.
More information about the freebsd-questions
mailing list