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

Re: cd, pwd and symlinks



Hubert Canon (Hubert.Canon@xxxxxxxx) wrote:
> Hi,
> 
> I have strange behaviours with symlinks to directories.

[snip]

Put `setopt chaselinks' or `setopt chasedots' in your .zshrc.  From
the info pages:

CHASE_DOTS
     When changing to a directory containing a path segment `..' which
     would otherwise be treated as cancelling the previous segment in
     the path (in other words, `foo/..' would be removed from the path,
     or if `..' is the first part of the path, the last part of $PWD
     would be deleted), instead resolve the path to the physical
     directory.  This option is overridden by CHASE_LINKS.

     For example, suppose /foo/bar is a link to the directory /alt/rod.
     Without this option set, `cd /foo/bar/..' changes to /foo; with it
     set, it changes to /alt.  The same applies if the current directory
     is /foo/bar and `cd ..' is used.  Note that all other symbolic
     links in the path will also be resolved.

CHASE_LINKS (-w)
     Resolve symbolic links to their true values when changing
     directory.  This also has the effect of CHASE_DOTS, i.e. a `..'
     path segment will be treated as referring to the physical parent,
     even if the preceeding path segment is a symbolic link.



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