The shell program /bin/bash (hereafter referred to as
“the shell”) uses a collection
of startup files to help create an environment to run in. Each file
has a specific use and may affect login and interactive environments
differently. The files in the /etc
directory provide global settings. If an equivalent file exists in
the home directory, it may override the global settings.
An interactive login shell is started after a successful login, using
/bin/login, by reading
the /etc/passwd
file. An interactive
non-login shell is started at the command-line (e.g., [prompt]$
/bin/bash). A non-interactive shell
is usually present when a shell script is running. It is
non-interactive because it is processing a script and not waiting for
user input between commands.
For more information, see info bash under the Bash Startup Files and Interactive Shells section, and Bash Startup Files in CBLFS.
The files /etc/profile
and ~/.bash_profile
are read when the shell is invoked
as an interactive login shell. Create a base /etc/profile
that will read locale information from
/etc/locale.conf
and load any Bash auto
completion files that may be on the system. This script also sets the
INPUTRC
environment variable that makes
Bash and Readline use /etc/inputrc
:
cat > /etc/profile << "EOF"
# Begin /etc/profile
source /etc/locale.conf
for f in /etc/bash_completion.d/*
do
if [ -e ${f} ]; then source ${f}; fi
done
unset f
export INPUTRC=/etc/inputrc
# End /etc/profile
EOF