profile.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/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. <para>The shell program <filename>/bin/bash</filename> (hereafter
  10. referred to as just "the shell") uses a collection of startup files to
  11. help create an environment to run in. Each file has a specific use and
  12. may affect login and interactive environments differently. The files in
  13. the <filename class="directory">/etc</filename> directory generally provide global
  14. settings. If an equivalent file exists in your home directory it may
  15. override the global settings.
  16. </para>
  17. <para>An interactive login shell is started after a successful login, using
  18. <filename>/bin/login</filename>, by reading the
  19. <filename>/etc/passwd</filename> file. An
  20. interactive non-login shell is started at the command-line (e.g.
  21. <prompt>[prompt]$</prompt><command>/bin/bash</command>). A non-interactive
  22. shell is usually present when a shell script is running. It is non-interactive
  23. because it is processing a script and not waiting for user input between
  24. commands.</para>
  25. <para>For more information see <command>info bash</command> --
  26. <emphasis role="strong">Nodes: Bash Startup Files and Interactive
  27. Shells.</emphasis></para>
  28. <para>The files <filename>/etc/profile</filename> and
  29. <filename>~/.bash_profile</filename> are read when the shell is invoked
  30. as an interactive login shell.</para>
  31. <para>A base <filename>/etc/profile</filename> created below only sets some
  32. environment variables necessary for Bash to accept keystrokes properly,
  33. even in non-English locale. Replace "ll" with the
  34. two-letter code for your language (e.g. "en") and
  35. "CC" with the two-letter code for your country
  36. (e.g. "GB"). Also you may need to specify
  37. (and this is actually the preferred form) your
  38. character encoding (e.g. "iso8859-1") after a dot (so that the result
  39. is "en_GB.iso8859-1").
  40. Issue the following command for more information:</para>
  41. <screen><userinput>man 3 setlocale</userinput></screen>
  42. <para>The list of all locales supported by glibc can be obtained by running
  43. the following command:</para>
  44. <screen><userinput>locale -a</userinput></screen>
  45. <para>Now, when you are sure about your locale settings, create the
  46. <filename>/etc/profile</filename> file:</para>
  47. <screen><userinput>cat &gt; /etc/profile &lt;&lt; "EOF"
  48. # Begin /etc/profile
  49. # Written for Linux From Scratch
  50. # by Alexander E. Patrakov
  51. export LC_ALL=ll_CC
  52. export LANG=ll_CC
  53. export INPUTRC=/etc/inputrc
  54. # End /etc/profile
  55. EOF</userinput></screen>
  56. <para>Setting the keyboard layout,
  57. the screen font and the locale-related environment variables
  58. are the only internationalization steps needed to support
  59. locales that use ordinary single-byte encodings and left-to-right
  60. writing direction. More complex cases (including UTF-8 based locales)
  61. require additional steps and additional patches because many applications
  62. tend to break in such conditions. Because of too little educational
  63. value for a typical reader, these steps and patches are not included
  64. in the LFS book and such locales are not supported by LFS in any way.
  65. </para>
  66. </sect1>