source: chapter07/profile.xml@ 81fd230

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since 81fd230 was 81fd230, checked in by Gerard Beekmans <gerard@…>, 19 years ago

Trunk is now identical to Testing

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4648 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 4.4 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
3 <!ENTITY % general-entities SYSTEM "../general.ent">
4 %general-entities;
5]>
6<sect1 id="ch-scripts-profile">
7<title>The Bash Shell Startup Files</title>
8<?dbhtml filename="profile.html"?>
9
10<indexterm zone="ch-scripts-profile"><primary sortas="e-/etc/profile">/etc/profile</primary></indexterm>
11
12<para>The shell program <command>/bin/bash</command> (hereafter
13referred to as <quote>the shell</quote>) uses a collection of startup
14files to help create an environment to run in. Each file has a
15specific use and may effect login and interactive environments
16differently. The files in the <filename
17class="directory">/etc</filename> directory provide global settings.
18If an equivalent file exists in the home directory, it may override
19the global settings.</para>
20
21<para>An interactive login shell is started after a successful login,
22using <command>/bin/login</command>, by reading the
23<filename>/etc/passwd</filename> file. An interactive non-login shell
24is started at the command-line (e.g.,
25<prompt>[prompt]$</prompt><command>/bin/bash</command>). A
26non-interactive shell is usually present when a shell script is
27running. It is non-interactive because it is processing a script and
28not waiting for user input between commands.</para>
29
30<para>For more information, see <command>info bash</command> - Nodes:
31Bash Startup Files and Interactive Shells.</para>
32
33<para>The files <filename>/etc/profile</filename> and
34<filename>~/.bash_profile</filename> are read when the shell is
35invoked as an interactive login shell.</para>
36
37<para>A base <filename>/etc/profile</filename> below sets some
38environment variables necessary for native language support. Setting
39them properly results in:</para>
40
41<itemizedlist>
42<listitem><para>The output of programs translated into the native
43language</para></listitem>
44<listitem><para>Correct classification of characters into letters,
45digits and other classes. This is necessary for Bash to properly
46accept non-ASCII characters in command lines in non-English
47locales</para></listitem>
48<listitem><para>The correct alphabetical sorting order for the
49country</para></listitem>
50<listitem><para>Appropriate default paper size</para></listitem>
51<listitem><para>Correct formatting of monetary, time, and date
52values</para></listitem>
53</itemizedlist>
54
55<para>This script also sets the <envar>INPUTRC</envar>
56environment variable that makes <application>Bash</application> and
57<application>Readline</application> use the
58<filename>/etc/inputrc</filename> file created earlier.</para>
59
60<para>Replace <replaceable>[ll]</replaceable> below with the
61two-letter code for the desired language (e.g., <quote>en</quote>) and
62<replaceable>[CC]</replaceable> with the two-letter code for the
63appropriate country (e.g., <quote>GB</quote>). It may also be
64necessary to specify (and this is actually the preferred form) the
65character encoding (e.g. <quote>iso8859-1</quote>) after a dot (so
66that the result is <quote>en_GB.iso8859-1</quote>). Issue the
67following command for more information:</para>
68
69<screen><userinput>man 3 setlocale</userinput></screen>
70
71<para>The list of all locales supported by Glibc can be obtained by running
72the following command:</para>
73
74<screen><userinput>locale -a</userinput></screen>
75
76<para>Once the proper locale settings have been determined, create the
77<filename>/etc/profile</filename> file:</para>
78
79<screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
80<literal># Begin /etc/profile
81
82export LC_ALL=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
83export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>
84export INPUTRC=/etc/inputrc
85
86# End /etc/profile</literal>
87EOF</userinput></screen>
88
89<note><para>The <quote>C</quote> (default) and <quote>en_US</quote>
90(the recommended one for United States English users) locales are
91different.</para></note>
92
93<para>Setting the keyboard layout, screen font, and
94locale-related environment variables are the only internationalization
95steps needed to support locales that use ordinary single-byte
96encodings and left-to-right writing direction. More complex cases
97(including UTF-8 based locales) require additional steps and
98additional patches because many applications tend to not work properly
99under such conditions. These steps and patches are not included in
100the LFS book and such locales are not supported by LFS in any
101way.</para>
102
103</sect1>
104
Note: See TracBrowser for help on using the repository browser.