zsh-workers
 help / Atom feed
* Re: SImple way to execute command on list of files?
       [not found] <20190414084632.t4gdc2fjswogznxy__31239.9886942998$1555231731$gmane$org@gmx.de>
@ 2019-04-14 13:50 ` Leah Neukirchen
  2019-04-24 10:53   ` Stephane Chazelas
  0 siblings, 1 reply; 2+ messages in thread
From: Leah Neukirchen @ 2019-04-14 13:50 UTC (permalink / raw)
  To: zsh-workers

Dominik Vogt <dominik.vogt@gmx.de> writes:

> Other than writing an alias or a function, is there a simple way
> to call commands that take only one file argument multiple times?
>
> In other words
>
>   $ xpdf *.pdf
>   $ ps2pdf a.ps b.ps c.ps
>
> should be executed (semantically) as
>
>   $ for F in *.pdf; do xpdf "$F"; done
>   $ ps2pdf a.ps; ps2pdf b.ps; ps2pdf c.ps
>
> I'm looking for a kind of extension for the command syntax.  Of
> course I could write a function with that syntax for each command,
> but is there a more general way where you can define a list of
> commands to treat differently, say
>
>   annoying_commands xpdf ps2pdf gv

autoload zargs
zargs -n1 *.pdf -- xpdf

-- 
Leah Neukirchen  <leah@vuxu.org>  http://leahneukirchen.org/


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: SImple way to execute command on list of files?
  2019-04-14 13:50 ` SImple way to execute command on list of files? Leah Neukirchen
@ 2019-04-24 10:53   ` Stephane Chazelas
  0 siblings, 0 replies; 2+ messages in thread
From: Stephane Chazelas @ 2019-04-24 10:53 UTC (permalink / raw)
  To: Leah Neukirchen; +Cc: zsh-workers

2019-04-14 15:50:36 +0200, Leah Neukirchen:
[...]
> autoload zargs
> zargs -n1 *.pdf -- xpdf

That's not shorter than

  for f (*.pdf) xpdf $f

though.

-- 
Stephane

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190414084632.t4gdc2fjswogznxy__31239.9886942998$1555231731$gmane$org@gmx.de>
2019-04-14 13:50 ` SImple way to execute command on list of files? Leah Neukirchen
2019-04-24 10:53   ` Stephane Chazelas

zsh-workers

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-workers

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.workers


AGPL code for this site: git clone https://public-inbox.org/ public-inbox