source: bootscripts/common/profile.xml@ 98b2c00

Last change on this file since 98b2c00 was bf8c11f, checked in by Jim Gifford <clfs@…>, 19 years ago

r627@server (orig r625): jim | 2005-10-31 12:59:34 -0800
Import of Cross-LFS Book

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