source: chapter07/profile.xml@ 5844aed2

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.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 5844aed2 was 39df528, checked in by Matthew Burgess <matthew@…>, 19 years ago

Fixed typo (Kim McCall)

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

  • Property mode set to 100644
File size: 5.0 KB
RevLine 
[b32e803]1<?xml version="1.0" encoding="ISO-8859-1"?>
[1770019]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
[b32e803]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
[81fd230]10<indexterm zone="ch-scripts-profile"><primary sortas="e-/etc/profile">/etc/profile</primary></indexterm>
[f67f5cf]11
[81fd230]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
[fe3130a]15specific use and may affect login and interactive environments
[81fd230]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
[4301028]30<para>For more information, see <command>info bash</command> under the
31<emphasis>Bash Startup Files and Interactive Shells</emphasis> section.</para>
[81fd230]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
[4301028]37<para>The base <filename>/etc/profile</filename> below sets some
[81fd230]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>
[faca37e]44<listitem><para>Correct classification of characters into letters, digits and
45other classes. This is necessary for <command>bash</command> to properly accept
46non-ASCII characters in command lines in non-English locales</para></listitem>
[81fd230]47<listitem><para>The correct alphabetical sorting order for the
48country</para></listitem>
49<listitem><para>Appropriate default paper size</para></listitem>
50<listitem><para>Correct formatting of monetary, time, and date
51values</para></listitem>
52</itemizedlist>
53
[37e62c3]54<para>This script also sets the <envar>INPUTRC</envar> environment variable that
55makes Bash and Readline use the <filename>/etc/inputrc</filename> file created
56earlier.</para>
[81fd230]57
58<para>Replace <replaceable>[ll]</replaceable> below with the
59two-letter code for the desired language (e.g., <quote>en</quote>) and
60<replaceable>[CC]</replaceable> with the two-letter code for the
[768efb56]61appropriate country (e.g., <quote>GB</quote>).
62<replaceable>[charmap]</replaceable> should be replaced with the
63canonical charmap for your chosen locale.</para>
[81fd230]64
65<para>The list of all locales supported by Glibc can be obtained by running
66the following command:</para>
67
68<screen><userinput>locale -a</userinput></screen>
69
[768efb56]70<para>Locales can have a number of synonyms, e.g. <quote>ISO-8859-1</quote> is
71also referred to as <quote>iso8859-1</quote> and <quote>iso88591</quote>.
72Some applications cannot handle the various synonyms correctly, so it is safest
73to choose the canonical name for a particular locale. To determine the
74canonical name, run the following command, where
75<replaceable>[locale name]</replaceable> is the output given by
76<command>locale -a</command> for your preferred locale
77(<quote>en_GB.iso88591</quote> in our example).</para>
78
79<screen><userinput>LC_ALL=<replaceable>[locale name]</replaceable> locale charmap</userinput></screen>
80
81<para>For the <quote>en_GB.iso88591</quote> locale, the above command
82will print:</para>
83
84<screen>ISO-8859-1</screen>
85
[39df528]86<para>This results in a final locale setting of <quote>en_GB.ISO-8859-1</quote>.</para>
[768efb56]87
[81fd230]88<para>Once the proper locale settings have been determined, create the
89<filename>/etc/profile</filename> file:</para>
[f67f5cf]90
[b32e803]91<screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
[d72e04a]92<literal># Begin /etc/profile
[b32e803]93
[768efb56]94export LANG=<replaceable>[ll]</replaceable>_<replaceable>[CC]</replaceable>.<replaceable>[charmap]</replaceable>
[b32e803]95export INPUTRC=/etc/inputrc
96
[d72e04a]97# End /etc/profile</literal>
[b32e803]98EOF</userinput></screen>
99
[81fd230]100<note><para>The <quote>C</quote> (default) and <quote>en_US</quote>
101(the recommended one for United States English users) locales are
102different.</para></note>
103
104<para>Setting the keyboard layout, screen font, and
105locale-related environment variables are the only internationalization
106steps needed to support locales that use ordinary single-byte
107encodings and left-to-right writing direction. More complex cases
108(including UTF-8 based locales) require additional steps and
109additional patches because many applications tend to not work properly
110under such conditions. These steps and patches are not included in
[4301028]111the LFS book and such locales are not yet supported by LFS.</para>
[81fd230]112
[b32e803]113</sect1>
[81fd230]114
Note: See TracBrowser for help on using the repository browser.