Author: ag
Date: 2007-07-30 13:23:41 -0600 (Mon, 30 Jul 2007)
New Revision: 6991
Modified:
trunk/BOOK/introduction/welcome/changelog.xml
trunk/BOOK/postlfs/config/profile.xml
Log:
Removed the extra-prompt.sh script and modifications to PS1 variable
Modified: trunk/BOOK/introduction/welcome/changelog.xml
===================================================================
--- trunk/BOOK/introduction/welcome/changelog.xml 2007-07-30 18:52:36 UTC
(rev 6990)
+++ trunk/BOOK/introduction/welcome/changelog.xml 2007-07-30 19:23:41 UTC
(rev 6991)
@@ -45,6 +45,11 @@
<para>July 30th, 2007</para>
<itemizedlist>
<listitem>
+ <para>[ag] - Removed the extra-prompt.sh script. Avoid to export the
PS1
+ variable, and modified it. Thanks to David Jensen for the
suggestions and
+ to Craig Jackson for the report.</para>
+ </listitem>
+ <listitem>
<para>[ag] - Added a warning in mutt instructions, about linking mutt
against GnuTLS.</para>
</listitem>
Modified: trunk/BOOK/postlfs/config/profile.xml
===================================================================
--- trunk/BOOK/postlfs/config/profile.xml 2007-07-30 18:52:36 UTC (rev
6990)
+++ trunk/BOOK/postlfs/config/profile.xml 2007-07-30 19:23:41 UTC (rev
6991)
@@ -140,9 +140,17 @@
# Setup some environment variables.
export HISTSIZE=1000
export HISTIGNORE="&:[bf]g:exit"
-#export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+# Setup a red prompt for root and a green one for users.
+NORMAL="\[\e[0m\]"
+RED="\[\e[1;31m\]"
+GREEN="\[\e[1;32m\]"
+if [[ $EUID == 0 ]] ; then
+ PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
+else
+ PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
+fi
+
for script in /etc/profile.d/*.sh ; do
if [ -r $script ] ; then
. $script
@@ -295,33 +303,8 @@
</sect3>
- <sect3 id="extra-prompt.sh">
- <title>/etc/profile.d/extra-prompt.sh</title>
-
- <indexterm zone="postlfs-config-profile extra-prompt.sh">
- <primary
sortas="e-etc-profile.d-prompt.sh">/etc/profile.d/extra-prompt.sh</primary>
- </indexterm>
-
- <para>This script shows an example of a different way of setting the
- prompt. The normal variable, <envar>PS1</envar>, is supplemented by
- <envar>PROMPT_COMMAND</envar>. If set, the value of
- <envar>PROMPT_COMMAND</envar> is executed as a command prior to issuing
- each primary prompt. The sequence \e is an ESC character. \a is a
- BEL character. For a reference on <command>xterm</command> escape
- sequences, see <ulink
- url="http://rtfm.etla.org/xterm/ctlseq.html"/>.</para>
-
-<screen role="root"><userinput>cat > /etc/profile.d/extra-prompt.sh
<< "EOF"
-<literal>PROMPT_COMMAND='echo -ne "[EMAIL PROTECTED] : ${PWD}\e[0m\a"'
-export PROMPT_COMMAND</literal>
-EOF</userinput></screen>
-
- <para>The escape sequences above are BOLD, NORMAL, and BEL.</para>
-
- </sect3>
-
<sect3 id="i18n.sh">
- <title>'/etc/profile.d/i18n.sh'</title>
+ <title>/etc/profile.d/i18n.sh</title>
<indexterm zone="postlfs-config-profile i18n.sh">
<primary
sortas="e-etc-profile.d-i18n.sh">/etc/profile.d/i18n.sh</primary>
@@ -384,8 +367,14 @@
# PS1 Environment Variable for a great case study behind this script
# addendum.]
-#export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+NORMAL="\[\e[0m\]"
+RED="\[\e[1;31m\]"
+GREEN="\[\e[1;32m\]"
+if [[ $EUID == 0 ]] ; then
+ PS1="$RED\u [ $NORMAL\w$RED ]# $NORMAL"
+else
+ PS1="$GREEN\u [ $NORMAL\w$GREEN ]\$ $NORMAL"
+fi
# End /etc/bashrc</literal>
EOF</userinput></screen>
--
http://linuxfromscratch.org/mailman/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page