Subject: Re: Root .profile
To: NetBSD-current Users <>
From: Brian D Chase <>
List: current-users
Date: 04/11/1999 18:09:27
On Sun, 11 Apr 1999, Curt Sampson wrote:
> On Sun, 11 Apr 1999, Brian D Chase wrote:

> > It would likely be wise to include logic
> > to determine '$ ' vs '# ' prompts in case a normal user with /bin/sh
> > decides to not have a $HOME/.profile
> You don't need to do that in the profile; the shell does # for root
> and $ for non-root automatically.

How ideal. :-)  I don't really mind the inclusion of the hostname in the
prompt though.  It can often be helpful.  

# Example /etc/profile
export PATH


export HOME

# The "-O" test is my attempt at a hack to ascertain whether I'm
# running with the super-user uid.  It only tests for the effective uid
# of the current process vs the owner of a file.  I used "/" as the file
# to compare against, maybe there's a better file to check but I figured
# "/" is most likely to be owned by root.  See test(1) for -O details.

if [ -O / ]; then
	PS1="${HOST:=`/bin/hostname -s`}# "
	PS1="${HOST:=`/bin/hostname -s`}$ "

# end

Brian "JARAI" Chase | | VAXZilla LIVES!!!