Subject: Re: Root .profile
To: Charles M. Hannum <firstname.lastname@example.org>
From: Lord Isildur <email@example.com>
Date: 04/12/1999 09:28:13
if you want sh to put a # on the end of PS1 if its running as root,
why not modify sh itself? it'd be a lot faster than running id!!
even then thats a system call and lots of extra junk not directly related to
the job of being a shell..
On Sun, 11 Apr 1999, Charles M. Hannum wrote:
> > ENV=$HOME/.shrc; export ENV
> > PS1="$(hostname -s)"
> > if [ -x /usr/bin/id -a $(/usr/bin/id -u) -eq 0 ]; then
> > PS1="$PS1 # "
> > else
> > PS1="$PS1 $ "
> > fi
> Ignoring the obvious errors, there are two problem with this:
> 1) It causes 2 other programs to be started up *every* time sh(1) is
> run. Consider the effect of this on a `make build' on a VAX. The
> performance loss can be measured in hours, maybe even days.
> 2) There is absolutely no reason to do something that complicated.
> Just save the host name in a variable and concatenate the default
> PS1 (in the same way as my code does) in `.shrc'.
> Why make the problem harder than it actually is??