Problem with su -

Bob Goodwin bobgoodwin at wildblue.net
Mon Mar 5 23:50:32 UTC 2012


On 05/03/12 17:07, jdow wrote:
> What does "set|grep PS" return to you? PS1 is likely your ill 
> component. When
> you see the actual string it has you can search for that. The string 
> probably
> does not look like the default. I think the default is '[\u@\h \W]\$ ' 
> with the
> single quotes.
>

        "set|grep PS" Produces more data than I can deal with visually,
        roughly two screens full ...


> Once you know the errant string you can look for it fairly easily if you
> escape the backslashes. And with that in mind, bashrc has this string 
> in it:
> [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
>
> So it looks like you can expect to see that bash script under SOME 
> conditions.
> And reading that line leads me to suspect I need to look at "man 
> bash". That
> tells me this string is the default for a bash shell if nothing else 
> sets the
> prompt differently.
>
> Is your /etc/bashrc file still there? And if it is look for the reason it
> skips that line. This is the context in my SL6.2 install. The significant
> line is the third one up from the bottom of my clipping.
> ===8<---
> if [ "$PS1" ]; then
>     case $TERM in
>     xterm*)
>         if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
>             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
>         else
>             PROMPT_COMMAND='echo -ne 
> "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
>         fi
>         ;;
>     screen)
>         if [ -e /etc/sysconfig/bash-prompt-screen ]; then
>             PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
>         else
>             PROMPT_COMMAND='echo -ne 
> "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
>         fi
>         ;;
>     *)
>         [ -e /etc/sysconfig/bash-prompt-default ] && 
> PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
>         ;;
>     esac
>     # Turn on checkwinsize
>     shopt -s checkwinsize
>     [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
>     # setup mkd alias
>     alias mkd=". /usr/local/bin/mkd"
> ===8<---
>
> {^_^}

These look identical to me ~
 From box6 which works as expected:
[ -e /etc/sysconfig/bash-prompt-default ] && 
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default


 From Box9 with the strange prompt:
[ -e /etc/sysconfig/bash-prompt-default ] && 
PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default

.


More information about the users mailing list