Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: cd -q (was Re: _canonical_path ...)
- X-seq: zsh-workers 24761
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Peter Stephenson <pws@xxxxxxx>
- Subject: Re: PATCH: cd -q (was Re: _canonical_path ...)
- Date: Thu, 27 Mar 2008 12:25:31 +0000
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <20080327121525.5b4059f9@news01>
- Mail-followup-to: Peter Stephenson <pws@xxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <080326083638.ZM16858@xxxxxxxxxxxxxxxxxxxxxx> <200803261540.m2QFeJmm017381@xxxxxxxxxxxxxx> <200803261604.m2QG41Ke017772@xxxxxxxxxxxxxx> <200803261621.m2QGLptV017966@xxxxxxxxxxxxxx> <20080326173824.0a55c00d@xxxxxxxxxxxxxxxxxxxxxx> <20080326164615.1d5893ed@news01> <20080327102325.55808716@news01> <20080327120807.415095ee@xxxxxxxxxxxx> <20080327112506.7298e9ef@news01> <20080327121525.5b4059f9@news01>
On Thu, Mar 27, 2008 at 12:15:25PM +0000, Peter Stephenson wrote:
> On Thu, 27 Mar 2008 11:25:06 +0000
> Peter Stephenson <pws@xxxxxxx> wrote:
> > I thought unfunction was silent if a function didn't exist, as is now
> > true of (and required for) unset, but apparently not.
> > +_canonical_paths_pwd() {
> > + # Get the canonical directory name by changing to it.
> > + # To be run in a subshell.
> > + (( ${+functions[chpwd]} )) && unfunction chpwd
> > + setopt CHASE_LINKS
> > + cd $1 2>/dev/null && pwd
> > +}
[...]
You need cd -- "$1"
you might also want cd -P.
With "emulate sh", cd -P -- "$1" && pwd -P should return an
absolute path.
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author