Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Quoting =(command)
- X-seq: zsh-users 10266
- From: "A. Wik" <aw@xxxxx>
- Subject: Re: Quoting =(command)
- Date: Mon, 15 May 2006 15:17:21 +0000 (GMT)
- Cc: Zsh users <zsh-users@xxxxxxxxxx>
- In-reply-to: <200603261837.k2QIbOow004386@xxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <200603261837.k2QIbOow004386@xxxxxxxxxxxxxxxxx>
(Look, it's not even a month old ;)
On Sun, 26 Mar 2006, Peter Stephenson wrote:
> [This is probably more in the line of zsh-users.]
I'm inclined to agree - however, not considering the point
of view of posting at the time of reading the subscription
instructions, I interpreted them as "just forget zsh-users
and join zsh-workers for the full range of content"... (but
I'll try it now.)
> "A. Wik" wrote:
> >
> > How do I quote the =(<commands>) syntax that returns a the
> > name of a temporary file containing the output of <commands>?
> >
> > Example: star is an improved tar program that can take a list of
> > files to archive through the =<list> command-line parameter - in
> > this case, the list is to be generated by the find program:
> > # star -cv f=etc-bak.tar -C / list==(cd / ; find ./etc -newer /tmp/mtime.
> > ref)
> > zsh: parse error near `)'
>
> Do you mean star takes a *file containing* the list of files to archive?
> If it was just the list itself, then you would use "$(...)".
Yes, I did mean the former - the argument of "list=" is always
a file name... or as I discovered later, a dash (-) for reading
from stdin, and which was, of course, the perfect solution to my
problem.
Although the lone dash is interpreted similary by many other
programs too, a solution internal to the shell is certain
to come in handy some day... and Bart's second reply suggests
a workaround about as concise as can reasonably be expected:
star -cv f=bak.tar list=${:-=(commands...)}
Perhaps it should be mentioned or at least hinted at in the
context of the =() construct, as that was where I started
looking. Considering that even you as the lead developer
managed to miss it, the odds may not be in favour of the
casual explorer doing so... but at least hindsight seems
to help:
${name:-word}
If name is set and is non-null then substitute
its value; otherwise substitute word. If name
is missing, substitute word.
-aw
Messages sorted by:
Reverse Date,
Date,
Thread,
Author