1

My bash prompt currently starts with the following variables :

\#/\!

which means

\#   The command number of this command.

\!   The history number of this command.

So \# is specific to each terminal but the \! is relative the global history file.

In zsh, %! appears to be equivalent to bash \#.

How do you translate bash \! in zsh ?

1 Answer 1

2

I don't think you have the equivalent in zsh, but you can do the same thing by using a counter in preexec:

preexec() { psvar[1]=$((cctr++)) }
PS1='%1v/%! '

is more or less equivalent to PS1='\#/\! ' in bash.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .