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

Re: brace expansion in function



On Sun, 13 Jun 2004, Eric Smith wrote:

> I would like a shell function that expands the arg
> {corrs,dylan,crespo}

Do you mean that you have typed

	mpg {corrs,dylan,crespo}

?? If that's what you did, then the shell will have expanded the braces
before invoking the function, so it is the same as if you'd typed

	mpg corrs dylan crespo

(which is actually fewer characters, so I'm not sure why you didn't just
type that directly) in which case what you want is something like

	mpg() { mpg321 *${^@}* }

If instead you mean that you typed

	mpg '{corrs,dylan,crespo}'

or some such quoting, then you need

	mpg() { eval "mpg321 *$1*" }

If none of this looks reasonable, you'll have to ask a more detailed 
question.



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