Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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)› '
share|improve this question
up vote 2 down vote accepted

%\ 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.