[CentOS] format level 3 prompt

Wed Nov 18 17:09:34 UTC 2009
Les Mikesell <lesmikesell at gmail.com>

Mike - email ignored wrote:
> On Wed, 18 Nov 2009 09:22:44 -0700, m.roth-x6lchVBUigD1P9xLtpHBDw wrote:
> 
>>> On Wed, 18 Nov 2009 08:25:48 -0700, m.roth-x6lchVBUigD1P9xLtpHBDw
>>> wrote: [...]
>>>> Ah! Permission/ownership problem?
>>>>
>>> Good suggestion.  I found that for myUser .bashrc had the wrong
>>> permissions and .bash_profile was missing!  I am sure that this
>>> happened because I copied /home/myUser was copied in from backup before
>>> the account was created.  We won't do that again.
>>>
>>> But now, I still do not see how the prompt is set since I have no
>>> /etc/sysconfig/bash-prompt-default .
>> >From the code /etc/bashrc:
>> <...>
>>     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
>>         ;;
>> <...>
>>
>>          mark
> 
> Not so.  With this debug:
> 
> ---
> 
> echo TERM = $TERM
> 
> # are we an interactive shell?
> 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)
> echo doing 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
>       ;;
>    *)
> echo doing default
>       [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/
> sysconfig/bash-prompt-default
>        ;;
>     esac
> 
> ---
> 
> I get:
> 
> TERM = linux
> doing default
> 
> The mystery remains.

That looks right for a direct console login.  What did you expect to happen?

-- 
   Les Mikesell
     lesmikesell at gmail.com