Subject: Root .profile
To: Brian D Chase <bdc@world.std.com>
From: Curt Sampson <cjs@cynic.net>
List: current-users
Date: 04/11/1999 12:34:43
On Sun, 11 Apr 1999, Brian D Chase wrote:

> Just noticed that on my diskless setup during a fresh install of 1.4_ALPHA
> that things are a little askew.  The /.profile assumes the presence of
> `/usr/bin/id' which initially isn't available since my /usr won't get
> mounted until after I've configured my /etc/rc.conf.

Charles just fixed this by removing the call to ID. I'm not sure
a better fix wouldn't be along the lines of `test -x /usr/bin/id
&& id'.

But there's something more I want to point out about this .profile:
it only works for you initial shell, and the prompt and shell
functions get lost in subshells. What do you think about doing it
the way I've been doing it for a few years, which is to add

    ENV=$HOME/.shrc; export ENV

to the .profile, and then put something similar to the following
in .shrc:

    set -o vi
    alias lf='ls -CF'
    alias ll='ls -l'
    PS1="$(hostname -s)"
    if [ -x /usr/bin/id -a $(/usr/bin/id -u) -eq 0 ]; then
	    PS1="$PS1 # "
    else
	    PS1="$PS1 $ "
    fi

This sort of thing used to be annoying with `make -j' because every
time it spawned a subshell with -x, the $ENV file would be printed
out, but I fixed that recently by adding an option to /bin/sh not
to print the $ENV file as it executes it.

Note that replies are redirected to current-users only.

cjs
-- 
Curt Sampson  <cjs@cynic.net>   604 801 5335   De gustibus, aut bene aut nihil.
The most widely ported operating system in the world: http://www.netbsd.org