zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh hackers list <zsh-workers@sunsite.dk>
Subject: Re: Quoting =(command)
Date: Sun, 26 Mar 2006 19:37:23 +0100	[thread overview]
Message-ID: <200603261837.k2QIbOow004386@pwslaptop.csr.com> (raw)
In-Reply-To: Message from "A. Wik" <aw@aw.gs>  of "Sun, 26 Mar 2006 16:37:56 -0000." <20060326161218.U67912@dynamite.narpes.com>

[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@ntlworld.com>
Web page still at http://www.pwstephenson.fsnet.co.uk/


      reply	other threads:[~2006-03-26 18:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <aw@aw.gs>
2006-03-26 16:37 ` A. Wik
2006-03-26 18:37   ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200603261837.k2QIbOow004386@pwslaptop.csr.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).