Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: how to refer to basename of $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?



Messages sorted by: Reverse Date, Date, Thread, Author