1

How can I prevent my zsh prompt from showing the variable name a path is assigned to instead of the path itself?

foo="/some/path"
cd "$foo"

shows $ ~foo/ in my prompt instead $ /some/path/

owzim
  • 885
  • 2
  • 9
  • 19
  • 3
    Are you using `zsh` or `bash`? You can't be using both at once. That aside, you're seeing [`Named Directories`](http://zsh.sourceforge.net/Guide/zshguide02.html#l20). Check if `AUTO_NAME_DIRS` is set (`setopt | grep AUTO_NAME_DIRS`) - to disable this functionality, turn it off. – simont Apr 25 '13 at 04:12
  • `PS1` is the variable containing the format of your prompt. Check some questions like http://stackoverflow.com/questions/10911378/custom-ps1-not-showing-the-current-working-directory/10926517#10926517 – fedorqui Apr 25 '13 at 08:17
  • @simont thanks. I use zsh. The option it's called "autonamedirs" on my machine and I unset it via unsetopt autonamedirs and it worked. – owzim Apr 25 '13 at 20:04
  • @fedorqui thank you. I know about PS1 but the behaviour as I described before is obviously connected to "Named Directories" as simont described. – owzim Apr 25 '13 at 20:08

1 Answers1

4

From the comments:

you're seeing Named Directories. Check if AUTO_NAME_DIRS is set (setopt | grep AUTO_NAME_DIRS) - to disable this functionality, turn it off.

simont
  • 68,704
  • 18
  • 117
  • 136