Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 1997 11:06:21 -0700 (MST)
From:      Charles Mott <cmott@snake.srv.net>
To:        Sheldon Hearn <axl@iafrica.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: su and PS1 
Message-ID:  <Pine.BSF.3.96.970825105632.8496A-100000@darkstar.home>
In-Reply-To: <7936.872527207@axl.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 25 Aug 1997, Sheldon Hearn wrote:
> 
> > If you are using bash, and PS1='\$', then the prompt will be $ for a
> > normal user account and # after su to root.  This is described in the bash
> > man page.  I don't know how the other shells handle this.
> 
> You're correct. All of sh, bash and csh render \$ as "#" for superuser.
> But this has nothing to do with my original point.
> 
> My point is that the su manpage appears to claim that su does something
> it doesn't seem to do. Perhaps what the manpage _means_ is "if you
> change uid to 0 your shell will probably use a '#' as your prompt,
> depending on whether you use \$ in your PS1 environment variable". But
> that's not what it says.
> 
> It may just be badly worded, but the manpage is _easily_
> (mis)interpreted as meaning "su changes your prompt".
> 
> If this just boils down to poor wording, I don't think the su manpage
> should mention the change of prompt at all. The prompt change has 
> nothing to do with su. It's solely dependant on your shell and any 
> files your shell uses to configure the environment.
> 
> The exception is that su -l causes the shell to believe it's a login
> shell, hopefully forcing it to use profiles of some kind to configure
> the environment. Still, any effect this has on the prompt relates to 
> the shell, not su.
> 
> Is this the sort of hair-splitting that we'd all rather do without, or 
> do other people think the manpage would be clearer without the 
> reference to the superuser prompt?
> 
> Sheldon.

I think you have a point that the manpage should be updated to indicate
the true state of affairs.  Getting a distinguishable prompt for superuser
mode is important for a lot of people, and I for one, had to wander around
the manpages quite a while until I understood the matter. 

I think it would be reasonable to mention in the manpage for su which
shells (maybe all of them) handle PS1='\$' and to specifically state that
the prompt is controlled by the shell and not su.

Why don't you update the manpage and submit it one of the core team or
developers for inclusion in the FreeBSD distribution.  I'm sure they would
be quite open to this. 

Charles Mott  




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970825105632.8496A-100000>