Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: is this normal?



This brings up an interesting point.

First, remember that in the / directory, the file .. just points back
to / itself.

Now, I tried the following quick experiment.

Things to note:

- I use %~ in my RPROMPT string.

- $PWD seems to contain the 'pure' value of the current directory,
  pwd seems to heed any directory-processing options you have set
  (IE. chase_links)

- Like the man page says, indeed, the various escape sequences expand
  to the 'pure' value of $PWD.

lyric[79] cd /                                                                ~
lyric[80] cd ../etc                                                           /
lyric[81] pwd                                                           /../etc
/../etc
lyric[82] echo $PWD                                                     /../etc
/../etc
lyric[83] cd /                                                          /../etc


lyric[84] setopt chaselinks                                                   /
lyric[85] cd ../etc                                                           /
lyric[86] pwd                                                           /../etc
/etc
lyric[87] echo $PWD                                                     /../etc
/../etc
lyric[88] echo $ZSH_VERSION                                             /../etc
3.1.5

One way to resolve the quirkiness (but not necessarily the only) is to
do command substitution in the PROMPT string by running pwd. (Don't forget
to set the PROMPT_SUBST option) Note that for me, RPROMPT is the variable
to change, since that's where I display the current directory.

lyric[93] RPROMPT='$(pwd)'                                              /../etc
lyric[94]                                                                  /etc

This is only a quick fix for PROMPT-related issues. Other things such
as the directory stack still receive 'pure' values of $PWD.

Anyone else's thoughts?

On Sun, Feb 28, 1999 at 09:11:59PM +0200, Mircea Damian wrote:
> 
> Hello,
> 
> I'm using zsh-3.1.5 on many x86 machines. All have the same behavior:
> 
> dmircea@secu:~% cd /
> dmircea@secu:/% cd ../bin 
> dmircea@secu:/../bin% echo $ZSH_VERSION 
> 3.1.5
> dmircea@secu:/../bin% pwd
> /../bin
> dmircea@secu:/../bin% 
> 
> 
> Is that '/../bin' canonical? Do I miss something here?
> 
> -- 
> Mircea Damian
> Network Manager
> dmircea@xxxxxxxxx, dmircea@xxxxxx, dmircea@xxxxxxxx
> MD65-RIPE, MD2225, MD1-6BONE
> Phone: +40-1-4115246




Messages sorted by: Reverse Date, Date, Thread, Author