Bash Question

Slackrat tlug-MOdoAOVCFFcswetKESUqMA at public.gmane.org
Wed Mar 5 12:26:51 UTC 2008


I have a problem with the prompt colours in Bash 3.1

I have slackware 11.0 with no gnome or kde saving the qt libraries
necessary to run the Opera browser since Opera doesn't like the
libs with my qt 4.3.4 which is not a standard slack package.

The relevant section of /etc/profile is listed below.

The user accounts all display the assigned colours upon login as
does root.

Upon opening an rxvt terminal from the Fluxbox menu, "su -" correctly
gives a red prompt

But opening an "su" terminal, I am presented with a plain black prompt
" bash-3.1#" and "echo $PS1" gives "\s-\v\$" with "echo $UID" giving
"0"

I did want the magenta prompt for a "su" terminal that did not inherit
root's environment, although I do have black one which admittegly is a
different colour, but the prompt is not what I want and in
/etc/profile I set default to '' PS1="\e[0;35m[\u@\h \W]\$ \e[m " ''
(colour magenta) 

I need to run FileRunner as su since "su -" can't get a display

Does anyone have a Idea how I might change what the bash prompt
displays and the colour it uses please?

/etc/profile

# Set a default shell prompt:
 PS1="\e[0;35m[\u@\h \W]\$ \e[m "  # COLOR DEFAULTS TO MAGENTA
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
fi

if ( [ $UID -eq 0 ] ); then
         PS1="\e[0;31m[\u@\h \W]\$ \e[m "  # COLOR RED
fi

if ( [ $UID -eq 1000 ] ); then
         PS1="\e[0;34m[\u@\h \W]\$ \e[m "  # USER inconnu COLOR BLUE
fi

if ( [ $UID -eq 1001 ] ); then
         PS1="\e[0;36m[\u@\h \W]\$ \e[m "  # USER listserv COLOR CYAN
fi

if ( [ $UID -eq 1002 ] ); then
         PS1="\e[0;32m[\u@\h \W]\$ \e[m "  # USER tanya COLOR GREEN
fi


-- 
SlackRat
-
"It's not who Votes that Counts;
It's Who Counts the Votes"
Right Hillary??
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list