From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7748 invoked by alias); 6 Dec 2013 16:30:51 -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: 18200 Received: (qmail 27472 invoked from network); 6 Dec 2013 16:30:45 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131206083020.ZM1054@torch.brasslantern.com> Date: Fri, 06 Dec 2013 08:30:20 -0800 In-reply-to: <20131206132751.GA6509@ypig.lip.ens-lyon.fr> Comments: In reply to Vincent Lefevre "how to get the absolute pathname of the current shell?" (Dec 6, 2:27pm) References: <20131206132751.GA6509@ypig.lip.ens-lyon.fr> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: how to get the absolute pathname of the current shell? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Dec 6, 2:27pm, Vincent Lefevre wrote: } } I'd like to get an absolute pathname of the current shell, for } interactive shells (i.e. scripts are not concerned), in a startup } file (so that the current working directory has not changed). As far as I can tell there is no portable way to do this. Even C programs have to use different code depending on the OS. } 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 ...]