From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10620 invoked by alias); 9 Sep 2017 22:23:55 -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: 22876 Received: (qmail 777 invoked by uid 1010); 9 Sep 2017 22:23:55 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg0-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.83.41):SA:0(-1.9/5.0):. Processed in 2.727003 secs); 09 Sep 2017 22:23:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) 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, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=pM2OP6unYFPbsetGLhZa/xRQpC8NJzEZS5KPLU+1ZC0=; b=pPIT/blGTo8t+ShFJAP4YFUNq2uoA4ajQLZvBlWwLeAaKhDAHkCHWN3Kj+ctKRGmLS qovry89C4kN0Z8BvWY14dagbxFC88HEgWX4nYQgVK8WskLKGpFIf9TFMRN5qGhRBZhIV /ZJPECG/zi4oEXGI+LC4/UQMJan5na3YNTsnBl4kygWBi8aC/LDOjVdzdDY1i8j4MKmf iH3hpFwco/sVDEJgbpfdZfOHca6Qk317ajTP7zAFEOxSXja252OcevZW8HqG5/G9nls5 wTLJgtTjnHlSdHRIUH+NVe5UhtXSvjEbfm5OABPn/PYQb0L/5tyEOZ+RTVoeDNVVGYfk NQjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=pM2OP6unYFPbsetGLhZa/xRQpC8NJzEZS5KPLU+1ZC0=; b=Rc+WofpxU0Snchsof2yeoykXPKoENZgyIY9xDMNR2ZVfNjxYWdlkkxeHwgqwtd4dDo ZNp4Rdz8S14WEegPtF6JoBfLVCUyafIUrptTtfLnUcqKzY9X3rs5ayUgOsNt9x/mPREB 8qmlJzw7zDfP9LiB93vmgh+HQV/S9PSx5NWDls3QpdttfgRJnkamZaJQOMh7wpFgrmYx A8b0GZApSsx+u5HJaAyEpkKOzwIqHN45g9fjv/g/qauAHMNi9TRhn0qoYOt3yJb1OCq6 HwxWYIPCsU5L9vf9s/mHma0n9rz5vCxO+M+5SbcEgT2EV0AWr8cnnU++CdDIighOqCu6 cjrA== X-Gm-Message-State: AHPjjUgyfywo1KBWyi/S67RNX0WUOgXmni47pTOFxGkgghaBGIYdFlf4 7PjOxVOZKpkW3N8GYqo= X-Google-Smtp-Source: ADKCNb5LCv3npPbv1Y2fP4KbzKRvoS4/tOQyzGK3ZHqNI8A+ROGDm71n9vNKze3tBnAuSwTEcIX0hg== X-Received: by 10.101.81.10 with SMTP id f10mr7038289pgq.82.1504995830039; Sat, 09 Sep 2017 15:23:50 -0700 (PDT) From: Bart Schaefer Message-Id: <170909152512.ZM9176@torch.brasslantern.com> Date: Sat, 9 Sep 2017 15:25:12 -0700 In-Reply-To: <20170909213806.52qezvyk766loeg3@sinister.lan.codevat.com> Comments: In reply to Eric Pruitt "Re: Running "unset path" breaks PATH despite emulation being enabled" (Sep 9, 2:38pm) References: <20170908082917.v5j4vczoq75vs5lk@sinister.lan.codevat.com> <20170909213806.52qezvyk766loeg3@sinister.lan.codevat.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Running "unset path" breaks PATH despite emulation being enabled MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 9, 2:38pm, Eric Pruitt wrote: } Subject: Re: Running "unset path" breaks PATH despite emulation being enab } } I would like to replace "zsh" with the absolute path of the Z shell } interpreter in case the "zsh" being executed is not the first one listed } in a $PATH folder. After reading through some documentation and } reviewing the output of "set", I don't see a way to do this. For } comparison, Bash sets $BASH to the interpreter's path: I just had a look at the Bash sources. Chet will correct me if I'm wrong, but as far as I can tell if argv[0] is not already at least a partial path, then $BASH is set by doing a path search for the first matching executable. Thus $BASH will be "the first one listed in a $PATH folder" when argv[0] contains no "/" separators, even if the actual executable came from somewhere else. } Is there a similar value in Z shell or a built-in I can use? $ZSH_ARGZERO in sufficiently recent versions of the shell will give you the equivalent information, you just have to do the path search part yourself, which is simple enough with the "=" expander: [[ =$ZSH_ARGZERO != =$ZSH_NAME ]] && ... If NO_EQUALS is set then some uses of `whence ...` might be needed.