What does the sequence %\/ do in zsh prompt expansion? man zshmisc doesn't contain the string %\, which is where the rest of the prompt-specific expansions are.

The sequence can be seen in Holmans dotfiles:

  echo "%{$fg_bold[cyan]%}%1/%\/%{$reset_color%}"

export PROMPT=$'in $(directory_name)› '

1 Answer 1


%\ does nothing so is useless. Same for the $ in $'...'. No need for it since there's no escape sequence to expand there.

The whole thing can be written:

PS1='in %{$fg_bold[cyan]%}%1//%{$reset_color%}› '


PS1="in %{$fg_bold[cyan]%}%1//%{$reset_color%}› "

to have the $fg_bold... expanded at the time of that assignment rather than at each prompt.

No need to do the command substitution at each prompt since the output of directory_name doesn't change from one run to the next.

You probably don't want to export PS1 or PROMPT either.

You must log in to answer this question.

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