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

Re: SImple way to execute command on list of files?



Dominik Vogt <dominik.vogt@xxxxxx> 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@xxxxxxxx>  http://leahneukirchen.org/



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