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

Re: Quoting =(command)



[This is probably more in the line of zsh-users.]

"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 "$(...)".

If you really do want a file name containing the list, I think you're in
trouble because the code seems to indicate =(...) only works at the
start of the word: as the manual says, a full command argument must be
in that form.

You can keep the scoping benefit (i.e. the temporary lasts as long as it
needs to and is then deleted) using something like:

star_list() {
  star -cv f=$1 -c / list=$2
}
star_list etc-bak.tar =(cd / ; find ./etc -n newer /tmp/mtime.ref)

By the way, you can get rid of find, too:

ntr() { [[ $REPLY -nt /tmp/mtime.ref ]] }
star_list etc-bak.tar =(cd /; print -l ./etc/**/*(+ntr))

With older versions of the shell, you need e:ntr: instead of +ntr.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page still at http://www.pwstephenson.fsnet.co.uk/



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