1

I switched from bash shell to zsh. After sourcing a main part of my old .bashrc to .zshrc, I am faced a problem concerning the rendering of prompt with zsh (which works with bash) :

function ps1 {
        # PROMPT SECTION
        BLUE='\[\033[0;34m\]'
        LIGHT_CYAN='\[\033[1;36m\]'
        DEFAULT='\[\033[0m\]'
        PURPLE='\[\033[0;35m\]'
        LIGHT_PURPLE='\[\033[1;35m\]'
        LIGHT_GREEN='\[\033[0;32m\]'
        PINK='\[\033\[0;31m\]'


        # \! - History number of last command
        # $? - Exit value of last command
        # \t - Exit time of last command
        # \w - Current directory (relative)

PS1="$PURPLE|$DEFAULT$LIGHT_GREEN\u@$DEFAULT$LIGHT_CYAN\h$DEFAULT$PURPLE|$DEFAULT\t$PURPLE|$DEFAULT$LIGHT_PURPLE\w$DEFAULT$PURPLE|$DEFAULT "
}

ps1

Here a screen capture of my old bash prompt :

bahs prompt

Now, I would like to have the same prompt but with zsh using exe zsh :

zsh prompt

How to get with zsh the same prompt than with the bash prompt ? Which modifications have I to do ?

UPDATE 1:

I tried the following PS1 for zsh but the rendering is not the expected one :

autoload -U colors && colors
PS1="$fg[purple]|{$fg[green]%u@$fg[cyan]%m$fg[purple]|$fg[purple]%*$fg[purple]|$fg[purple]%~$fg[purple]| "

here's the capture :

trying to get the same zsh prompt than bash

Any idea to the same ?

You must log in to answer this question.

Browse other questions tagged .