From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23012 invoked by alias); 9 Dec 2013 09:45:28 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18206 Received: (qmail 21515 invoked from network); 9 Dec 2013 09:45:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Date: Mon, 9 Dec 2013 10:45:10 +0100 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: how to get the absolute pathname of the current shell? Message-ID: <20131209094510.GA31204@xvii.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20131206132751.GA6509@ypig.lip.ens-lyon.fr> <131206083020.ZM1054@torch.brasslantern.com> <20131209085330.GA30856@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20131209085330.GA30856@xvii.vinc17.org> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6305-vl-r59709 (2013-04-16) On 2013-12-09 09:53:30 +0100, Vincent Lefevre wrote: > On 2013-12-06 08:30:20 -0800, Bart Schaefer wrote: > > On Dec 6, 2:27pm, Vincent Lefevre wrote: > > } Currently I'm doing: ${$(whence -p ${0#-}):a} > > } > > } But this doesn't work when there are symbolic links > > > > If the above is otherwise good enough, why not ${$(whence -p ${0#-}):A} > > which uses realpath() when it is available? [See above about different > > code depending on OS ...] > > Using :A instead of :a doesn't solve the problem. After looking more closely, this is because "resolution of `..' occurs before resolution of symbolic links" (see zshexpn(1) man page). Since zsh's resolution of `..' is broken by design, i.e. incompatible with real resolution, as done by realpath (and the Linux kernel), :A and :a mustn't be used here. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)