Fixed Bash startup files to handle HOME and PS1.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@3132 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Greg Schafer 2003-12-12 01:43:31 +00:00
parent 6213d4cc48
commit 07ecae2532
3 changed files with 16 additions and 12 deletions

View File

@ -45,6 +45,9 @@
</itemizedlist> </itemizedlist>
</listitem> </listitem>
<listitem><para>December 11th, 2003 [greg]: Chapter 5: - Setting up the
environment: Fixed Bash startup files to handle HOME and PS1.</para></listitem>
<listitem><para>December 3rd, 2003 [greg]: Upgraded to Gettext-0.13, <listitem><para>December 3rd, 2003 [greg]: Upgraded to Gettext-0.13,
Man-pages-1.64, Linux-2.4.23 and Psmisc-21.4.</para></listitem> Man-pages-1.64, Linux-2.4.23 and Psmisc-21.4.</para></listitem>

View File

@ -352,17 +352,18 @@ startup files for the Bash shell. While logged in as user
<filename>.bash_profile</filename>:</para> <filename>.bash_profile</filename>:</para>
<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"</userinput> <screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"</userinput>
exec env -i TERM=$TERM /bin/bash exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash
<userinput>EOF</userinput></screen> <userinput>EOF</userinput></screen>
<para>The <userinput>exec env -i TERM=$TERM /bin/bash</userinput> command <para>The
creates a new instance of Bash with a completely empty environment, except for <userinput>exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash</userinput>
the TERM variable. This is needed to ensure that no unwanted and potentially command creates a new instance of Bash with a completely empty environment,
hazardous environment variables from the host system leak into our build except for the HOME, TERM and PS1 variables. This is needed to ensure that no
environment. The technique used here is a little non-standard but it achieves unwanted and potentially hazardous environment variables from the host system
the goal of enforcing a clean environment. By way of explanation, the initial leak into our build environment. The technique used here is a little
shell is a <emphasis>login</emphasis> shell which reads the non-standard but it achieves the goal of enforcing a clean environment. By way
<filename>.bash_profile</filename>. The new shell instance is a of explanation, the initial shell is a <emphasis>login</emphasis> shell which
reads the <filename>.bash_profile</filename>. The new shell instance is a
<emphasis>non-login</emphasis> shell which reads the <emphasis>non-login</emphasis> shell which reads the
<filename>.bashrc</filename> (created next).</para> <filename>.bashrc</filename> (created next).</para>

View File

@ -3,8 +3,8 @@
"/usr/share/docbook/docbookx.dtd" [ "/usr/share/docbook/docbookx.dtd" [
<!ENTITY version "CVS-20031203"> <!ENTITY version "CVS-20031211">
<!ENTITY releasedate "December 3rd, 2003"> <!ENTITY releasedate "December 11th, 2003">
<!ENTITY milestone "5.1"> <!ENTITY milestone "5.1">
<!ENTITY nbsp " "> <!ENTITY nbsp " ">