From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27211 invoked by alias); 29 Jul 2011 11:46: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: 16158 Received: (qmail 1151 invoked from network); 29 Jul 2011 11:46:39 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.82.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:reply-to:to:date:in-reply-to:references:content-type :x-mailer:content-transfer-encoding:message-id:mime-version; bh=d8kR1OsZ8Ncqk4mlJsWMwuKPNVc4RzkhNLrez2sTZiw=; b=GNOCTXsZmkv12B33xcwg2Cy7Gwh6edu691bDy4YiKkklJLy5T1At9WOhFji3KDiA9N 4qnJycVKewlwVLp373Q5000knpKEfvawhSAwBN8gm2YrPuYxWpzwscTU7SFmpfjWbTpZ zlcAfWCbKutIcaBK+FzJWZz1ri1QoYTPxQMDE= Subject: Re: how to refer to basename of $0 From: Tomasz Moskal Reply-To: ramshackle.industries@gmail.com To: zsh-users@zsh.org Date: Fri, 29 Jul 2011 12:48:03 +0100 In-Reply-To: <110728210438.ZM24370@torch.brasslantern.com> References: <110728210438.ZM24370@torch.brasslantern.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.0.2 Content-Transfer-Encoding: 7bit Message-ID: <1311940087.1494.27.camel@localhost.localdomain> Mime-Version: 1.0 On Thu, 2011-07-28 at 21:04 -0700, Bart Schaefer wrote: > On Jul 28, 9:39pm, TJ Luoma wrote: > } > } Is it even possible to set NAME in .zsh* (and have it return > } 'test.zsh' or are they called too early in the process? > > This is sounding awfully familiar. Oh, it was on zsh-workers, where > some of the -users crowd would not have seen it. > > Starts here: > > http://www.zsh.org/mla/workers/2011/msg00159.html > > Interesting branch begins here: > > http://www.zsh.org/mla/workers/2011/msg00163.html > > Particularly: > > http://www.zsh.org/mla/workers//2011/msg00172.html Thanks for the links, but I am still baffled - basename $0 is working here without any problems: % cat ~/.zshenv unsetopt function_argzero name=`basename $0` % cat ./foo #!/bin/zsh . ~/.zshenv echo $name exit 0 % ./foo foo Obviously it stops when I comment out unsetopt function_argzero but with it in place it there is no problems with reporting the script name - zsh -i / -l / -f make no difference. Only options I have set in .zshrc are to do with history, basic completion and prompt (what can I say? I am just getting acquainted with zsh). Obviously the OPEN_PLAN_OFFICE_NO_VIGILANTE_ATTACKS option is gone as well. Global zshenv has nothing but path and umask. So as you can see there is no weirdness in any of the files alas basename $0 do behave in a different way than described here on on -workers. What may be the reason of that?