Converting a zsh prompt to bash

Kyrre Nygard kyrreny at broadpark.no
Fri May 19 02:47:45 PDT 2006


At 22:48 18.05.2006, Dan Nelson wrote:

>Mine's strictly functional.  User, host, path in left prompt; error
>status in right prompt.  Within screen, I add the window number to the
>left prompt and the date&time to the right prompt so I know how long
>I've left a window idle.
>
>if [[ $+WINDOW = 1 && $TERM = screen* ]] ; then
>   PROMPT="(%n@%m.$WINDOW) %B%/>%(#/#/)%b "
>   RPROMPT="%(?.. %B%?%b)%t %D{%m/%d}"
>else
>   PROMPT="(%n@%m) %B%/>%(#/#/)%b "
>   RPROMPT="%(?..%?)"
>fi
>
>--
>         Dan Nelson
>         dnelson at allantgroup.com

This is what I'm now going to settle with.

The screen function was really wicked. I've always felt lost
while I'm messing about my screens.

If you have any advice, please make them regarding this setup:

if [[ `whoami` = root ]] then

         a1="%{$fg_bold[red]%}"
         a2="%{$fg_no_bold[red]%}"

else

         a1="%{$fg_bold[cyan]%}"
         a2="%{$fg_no_bold[cyan]%}"

fi

PROMPT="$a1(%n@%m)$a2(%D{%d/%m}+%D{%H:%M})"$'\n'
PROMPT+="$a2(%~) %{$reset_color%}"

if [[ $+WINDOW = 1 && $TERM = screen* ]] then

         PROMPT="$a1(%n@%m)$a2($WINDOW)(%D{%d/%m}+%D{%H:%M})"$'\n'
         PROMPT+="$a2(%~) %{$reset_color%}"

fi

Thanks :)

Kyrre




More information about the freebsd-questions mailing list