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

Re: Help on zsh grammar

Redirected to zsh-users ...

On Jan 22,  6:53pm, Andrej Borsenkow wrote:
} Subject: Re: Help on zsh grammar
} On Wed, 22 Jan 1997, Dietmar Rempfer wrote:
} > Let us define the following function:
} > 
} > test () { echo \"$*\" }
} > 
} > Now, if I do ``test blabla'', I get "blabla", which is what I want.
} > But if I say e.g. ``test *.aux'', I would like to see "*.aux" printed out,
} > but instead I get the message: zsh: no matches found: *.aux.

You're getting that error before `test' even runs, from the top-level shell
that's parsing the command line.  `$*' is -not- being globbed inside `test'.

} What about 
}    test '*.aux' :-)
} But really, you want
}    unsetopt nomatch

No, he doesn't.  What he wants is

	test () { echo \"$*\" }
	alias test 'noglob test'

Note that the alias must come after the function definition, or else you
define two functions (`noglob' and `test'), both of which do the echo.
(You can use `function test () { ... }' instead, but it's still a good
idea to always define aliases after defining functions.)

Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

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