On Κυρ, Μάρ 11, at 01:32 Dan Nicholson wrote:
> 
> I got the same problems when playing around with dash, but I'd never
> given it much thought. I think this is a good point and I'm gonna
> change all my shell setting files to not export PS1.
> 

Exporting PS1 using bash as my login shell,made my zsh prompt unreadable.
I know for sure that it can cause problems with the tab completion.

Thus the book should be updated and that is the small first attachment 
hopefully will do.


A small note that maybe worths considering.

I would rather see a different color prompt for the root (red) and for 
user (green maybe) - for obvious reasons. 

A simple construct like the following that can be placed to the 
/etc/bashrc, it should do the job.

if [[ ${EUID} == 0 ]] ; then
        PS1='\e[0;[EMAIL PROTECTED]:\e[0;39m\w\$ '
        else
        PS1='\e[0;[EMAIL PROTECTED]:\e[0;39m\w\$ '
fi

It's same PS1 that is in the Book but with added colors.
Please check the PS1 syntax if it is right or perhaps supply a better one if
you think there is one, because I don't care enough about bash to be honest.
That is the second patch about. 
Do as you like, either way is fine by me.
Index: postlfs/config/profile.xml
===================================================================
--- postlfs/config/profile.xml  (revision 6665)
+++ postlfs/config/profile.xml  (working copy)
@@ -141,7 +141,7 @@
 export HISTSIZE=1000
 export HISTIGNORE="&:[bf]g:exit"
 #export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+PS1='[EMAIL PROTECTED]:\w\$ '
 
 for script in /etc/profile.d/*.sh ; do
         if [ -r $script ] ; then
@@ -396,7 +396,7 @@
 # addendum.]
 
 #export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+PS1='[EMAIL PROTECTED]:\w\$ '
 
 # End /etc/bashrc</literal>
 EOF</userinput></screen>
Index: postlfs/config/profile.xml
===================================================================
--- postlfs/config/profile.xml  (revision 6665)
+++ postlfs/config/profile.xml  (working copy)
@@ -141,7 +141,7 @@
 export HISTSIZE=1000
 export HISTIGNORE="&amp;:[bf]g:exit"
 #export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+PS1='[EMAIL PROTECTED]:\w\$ '
 
 for script in /etc/profile.d/*.sh ; do
         if [ -r $script ] ; then
@@ -395,8 +395,11 @@
 # PS1 Environment Variable for a great case study behind this script
 # addendum.]
 
-#export PS1="[EMAIL PROTECTED] \w]\\$ "
-export PS1='[EMAIL PROTECTED]:\w\$ '
+if [[ ${EUID} == 0 ]] ; then
+        PS1='\e[0;[EMAIL PROTECTED]:\e[0;39m\w\$ '
+else
+        PS1=PS1='\e[0;[EMAIL PROTECTED]:\e[0;39m\w\$ '
+fi
 
 # End /etc/bashrc</literal>
 EOF</userinput></screen>
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to