Subject: Re: bash prompt
To: None <netbsd-users@NetBSD.org>
From: Mike Parson <mparson@bl.org>
List: netbsd-users
Date: 01/11/2005 11:41:48
On Tue, Jan 11, 2005 at 06:20:17PM +0100, Zafer Aydogan wrote:
> Hello Mailing-List,
> 
> Installing bash brings only a prompt that shows "bash-2.05$" 
> 
> Therefore I set in .profile
> export PS1="\u@\h: \w> "
> Then my prompt shows:
> 
> zafer@moe: ~>
> 
> This is fine, but if I su to root, I get
> the same prompt ending with >.
> 
> root@moe: /etc/>
> 
> How can I bringt bash to change the shell prompt to end with # 
> 
> root@moe: ~ #

Under PROMPTING of the bash manpage:

	\$     if the effective UID is 0, a #, otherwise a $

You're going to have a $ instead of your >, but that's how bash works.
I've found that I have to double the \\'s though.

I have mine set to:

PS1="\[\033[1m\][\t]\[\033[m\] [\w] \h \n\\$ "

> when I change from a user to root? 
> 
> Thanks, Zafer.
> 
> ps: Isn't it more userfriendly to set a useful default prompt, when
> installing bash like zafer@moe: ~ $ instead of bash-2.05b$ ?

That's just the default bash prompt if PS1 isn't set, take it up with
them. ;)

-- 
Michael Parson
mparson@bl.org