Subject: Re: Root .profile
To: NetBSD-current Users <current-users@netbsd.org>
From: Brian D Chase <bdc@world.std.com>
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
#
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
BLOCKSIZE=1k
export BLOCKSIZE
HOME=/root
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`}# "
else
PS1="${HOST:=`/bin/hostname -s`}$ "
fi
# end
-brian.
---
Brian "JARAI" Chase | http://world.std.com/~bdc/ | VAXZilla LIVES!!!