Re: base-files etc.
On Sun, Apr 26, 1998 at 09:30:04AM -0400, Avery Pennarun wrote:
> Incidentally, I've always wondered why there is no /etc/bashrc and
> /etc/bash_profile. They would be ideal for this.
In the default mode, which files to run at startup is hard-coded into bash,
and doesn't include those.
I always use bash in the POSIX startup mode, where it only executes
/etc/ENV, which then runs any other files necessary, for example mine is:
------
# /etc/ENV: Posix conformant startup script for /bin/sh
#
# A Posix conformant shell will read this file if environment variable ENV
# is set to /etc/ENV.
#
# This currently does almost but not quite like what bash does by
# default - the differences are the reading of root's .bashrc, for
# use with su, and the default bashrc if the user doesn't have one.
#
# Mark Baker - 31 October 1996
#
case "${--}" in *i*)
# Shell is interactive - no scripts used otherwise
# Check if it's a login shell. If so, read /etc/profile,
# then the users .profile
case "${0##*/}" in
-*)
if [ -f "/etc/profile" ]; then
# source /etc/profile
. /etc/profile
fi
if [ -n "${HOME-}" ] && [ -f "$HOME/.profile" ]; then
# source ~/.profile
. "$HOME/.profile"
fi
;;
esac
# For all shells, read the bashrc.
# If it's root, read root's one. On an su, this isn't
# $HOME/.bashrc, but I think it's desirable to use
# root's one anyway, if only to get a different prompt
if [ $(whoami) = "root" ] && [ -f ~root/.bashrc ]; then
. ~root/.bashrc
# Otherwise, look for a ~/.bashrc
elif [ -n "${HOME-}" ] && [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
# If that fails, look for a system default one
elif [ -f "/etc/bashrc" ]; then
. /etc/bashrc
fi
;;
esac
------
To get this to work I had to patch my bash so I could enable this startup
mode without all the other POSIX (mis-)features.
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: