Problem with su -

Ed Greshko Ed.Greshko at greshko.com
Tue Mar 6 11:30:50 UTC 2012


On 03/06/2012 07:09 PM, Bob Goodwin wrote:
> On 06/03/12 05:15, Ed Greshko wrote:
>> OK.... You have an unmodified ~/.bash_profile and a slightly
>> different ~/.bashrc from my fresh install. The differences are not
>> significant. The bottom line is that in ~/.bashrc you have if [ -f
>> /etc/bashrc ]; then . /etc/bashrc Which should source the file. The
>> place where the setting of PS1 takes place is here....
>>>        # Turn on checkwinsize
>>>        shopt -s checkwinsize
>>>        [ "$PS1" = "\\s-\\v\\\$ " ]&&  PS1="[\u@\h \W]\\$ "
>> Basically it is saying....  if PS1 is set to '\s-\v\$ ' change it to
>> '[\u@\h \W]\$ ' .
>>
>> So, it would seem, one of 2 things are going on.  Either the file isn't
>> being sourced or it isn't set as expected.
>>
>> What I would do is modify /etc/bashrc to ....
>>
>>    shopt -s checkwinsize
>>    echo "PS1 is set to $PS1">  /tmp/huh
>>    [ "$PS1" = "\\s-\\v\\\$ " ]&&  PS1="[\u@\h \W]\\$ "
>>
>> And then perform an su -.
>>
>
>
>
>    Ok, is this what you are suggesting I do?
>
>           shopt -s checkwinsize
>        #  [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
>           echo "PS1 is set to $PS1" > /tmp/huh
>           [ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "

I am suggesting that you *add* the single line

echo "PS1 is set to $PS1" > /tmp/huh

directly after the line reading

shopt -s checkwinsize


In your next email you seem to have done what I've suggested and
reported....

                bash-4.2# cat /tmp/huh
                PS1 is set to \s-\v\$

             It does that ...

You said you have this....

       bash-4.2# ls /etc/bashrc*
       /etc/bashrc  /etc/bashrc~  /etc/bashrc.wrkng

I don't know what /etc/bashrc~ since I don't have one on my system. 
Maybe move that to /tmp or something and try again?

I also note that "ll" doesn't seem to work.  That is also troublesome
since it would seem to indicate a problem with sourcing the files in
/etc/profile.d.  You do have a /etc/profile file?

Another thing to try....

Move /etc/bashrc.wrkng back to /etc/bashrc and then "su -".  You'll have
the "bad" prompt.  But then type ". /etc/bashrc" and see if there are
any error messages.

-- 
Do not condemn the judgment of another because it differs from your own.
You may both be wrong. -- Dandemis


More information about the users mailing list