Problem with su -

jdow jdow at earthlink.net
Tue Mar 6 00:14:03 UTC 2012


On 2012/03/05 15:50, Bob Goodwin wrote:
> 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 ...

Um, you are using bash. Have you heavily modified your system? This is all
it should produce:
===8<---
GROUPS=()
PS1='[\u@\h \W]\$ '
PS2='> '
PS4='+ '
===8<---

"set" without any "|grep PS" following it is a whole lot of lines of stuff.
But that's not what you did, theoretically.

set|grep PS1

should produce only the "PS1='[\u@\h \W]\$ '" line from the above.

>> 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

Then somehow while it still declares you are using bash your bash is not
reading /etc/bashrc for some reason. You might check its permissions:
-rw-r--r--. 1 root root 2679 Jun 28  2011 /etc/bashrc

{^_^}


More information about the users mailing list