[3f8be484] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[aa18ac0] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[3f8be484] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[0d36d0a] | 8 | <sect1 id="ch-config-profile">
|
---|
[3f8be484] | 9 | <title>The Bash Shell Startup Files</title>
|
---|
| 10 | <?dbhtml filename="profile.html"?>
|
---|
| 11 |
|
---|
[0d36d0a] | 12 | <indexterm zone="ch-config-profile">
|
---|
[3f8be484] | 13 | <primary sortas="e-/etc/profile">/etc/profile</primary>
|
---|
| 14 | </indexterm>
|
---|
| 15 |
|
---|
| 16 | <para>The shell program <command>/bin/bash</command> (hereafter
|
---|
| 17 | referred to as <quote>the shell</quote>) uses a collection of startup
|
---|
| 18 | files to help create an environment to run in. Each file has a
|
---|
| 19 | specific use and may affect login and interactive environments
|
---|
[73e1db21] | 20 | differently. The files in the <filename class="directory">/etc</filename>
|
---|
| 21 | directory provide global settings. If an equivalent file exists in the
|
---|
| 22 | home directory, it may override the global settings.</para>
|
---|
[3f8be484] | 23 |
|
---|
| 24 | <para>An interactive login shell is started after a successful login,
|
---|
| 25 | using <command>/bin/login</command>, by reading the
|
---|
| 26 | <filename>/etc/passwd</filename> file. An interactive non-login shell
|
---|
| 27 | is started at the command-line (e.g.,
|
---|
| 28 | <prompt>[prompt]$</prompt><command>/bin/bash</command>). A
|
---|
| 29 | non-interactive shell is usually present when a shell script is
|
---|
| 30 | running. It is non-interactive because it is processing a script and
|
---|
| 31 | not waiting for user input between commands.</para>
|
---|
| 32 |
|
---|
| 33 | <para>For more information, see <command>info bash</command> under the
|
---|
[73e1db21] | 34 | <emphasis>Bash Startup Files and Interactive Shells</emphasis> section,
|
---|
| 35 | and <ulink url="&cblfs-root;index.php/Bash_Startup_Files">Bash Startup
|
---|
| 36 | Files</ulink> in CBLFS.</para>
|
---|
[3f8be484] | 37 |
|
---|
| 38 | <para>The files <filename>/etc/profile</filename> and
|
---|
| 39 | <filename>~/.bash_profile</filename> are read when the shell is
|
---|
[c58eb217] | 40 | invoked as an interactive login shell. Create a base
|
---|
| 41 | <filename>/etc/profile</filename> that will setup locale information and load
|
---|
| 42 | any bash auto completion files that may be on the system. This script also
|
---|
| 43 | sets the <envar>INPUTRC</envar> environment variable that makes Bash and
|
---|
| 44 | Readline use <filename>/etc/inputrc</filename>.</para>
|
---|
| 45 |
|
---|
| 46 | <screen><userinput>cat > /etc/profile << "EOF"
|
---|
| 47 | <literal># Begin /etc/profile
|
---|
| 48 |
|
---|
| 49 | source /etc/locale.conf
|
---|
[d38577a] | 50 |
|
---|
| 51 | for f in /etc/bash_completion.d/*
|
---|
| 52 | do
|
---|
| 53 | if [ -e ${f} ]; then source ${f}; fi
|
---|
| 54 | done
|
---|
| 55 | unset f
|
---|
| 56 |
|
---|
[c58eb217] | 57 | export INPUTRC=/etc/inputrc
|
---|
| 58 |
|
---|
| 59 | # End /etc/profile</literal>
|
---|
| 60 | EOF</userinput></screen>
|
---|
[630a58e] | 61 |
|
---|
[3f8be484] | 62 | </sect1>
|
---|