Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Help with functions
- X-seq: zsh-users 3052
- From: Oliver Kiddle <opk@xxxxxxxxxxxxx>
- To: "Cosgray, Nathan" <ncosgray@xxxxxxxxx>
- Subject: Re: Help with functions
- Date: Fri, 28 Apr 2000 11:15:28 -0400
- Cc: zsh-users@xxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <154A66C813EED311AECB00508B8B8D093F45EE@xxxxxxxxxxxxxxxxxxxxxxxxx>
Cosgray, Nathan wrote:
>
> FYI, I have fixed this problem by adding the following line to the END of
> the script in question:
>
> $*
>
> thus explicitly calling the function passed in the parameters to
> run_masterfile_step. It seems like a giant hack to me, but at least it
> works.
Sorry, I should have been clearer in my first reply. Putting the $* at
the end was significant because it needs to be after the functions are
defined otherwise the functions won't exist yet. In shell scripts,
functions are a bit like normal statements in that when control reaches
the line on which the function is defined, only then does the function
become defined. This means that you can do tricks like defining two
different versions of a function with the same name inside an if ...
then ... else.
I wouldn't call it a giant hack at all. I suspect that the $* was there
originally and got lost at some point.
> Where can I find documentation on '$@' and other such nifty things?
Have you got a copy of the manual somewhere? If not, you can browse the
HTML version on the zsh web pages at sunsite.auc.dk/zsh. There is a
section listing special parameters like $@ and $*. I would give you some
better references but I don't have access to the manual myself at the
moment. You may find the manual a bit heavy going so any book on UNIX
shell scripting will be mostly relevant to zsh scripts (but stick to
sections on the bourne/korn shells avoiding anything on the C-shell).
Oliver Kiddle
Messages sorted by:
Reverse Date,
Date,
Thread,
Author