Bash: Setting Prompt
John Oxley
john at yoafrica.com
Wed May 18 07:24:13 PDT 2005
On Wed, May 18, 2005 at 06:26:53AM -0400, Gerard Seibert wrote:
> I have the following in my '.bash_profile' file.
> #
> # Set the prompt to display the 'user at host' and the working
> # directory with a '#' for root and '$' for user.
> #
> PS1="\u@\h \w "
> case 'id -u' in
> 0) PS1="${PS1}# ";;
> *) PS1="${PS1}$ ";;
> esac
Okay you can do that or if you are using bash 2.05 or above, just do
this
PS1='\u@\h \w \$ '
The \$ is clever and is a # if you are root, and $ if you are not.
This is from my ~/.bashrc
export PS1='\[\e]2;\h:\w\a\e[1;32m\]\u@\h\[\e[m\]:\[\e[1;34m\]\w\[\e[m\]\$ '
--
John Oxley
Senior Systems Administrator
Yo!Africa
E-Mail: john at yoafrica.com
Tel: +263 4 858404 ext 2017
Cell: +263 91 335 109
More information about the freebsd-questions
mailing list