Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: script within find
- X-seq: zsh-users 11839
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: script within find
- Date: Fri, 14 Sep 2007 21:10:28 +1200 (NZST)
- In-reply-to: <7c737f300709110052t5797209w8ac77cd4d3aa6c3f@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <7c737f300702232339keaffa58g99b1f51de74e0c8a@xxxxxxxxxxxxxx> <20070224100809.GA4828@xxxxxxxxxxxxxxx> <7c737f300704251214r602027a4u2d3533370fd317a9@xxxxxxxxxxxxxx> <20070425215214.GA8900@xxxxxxxxxxxxxxxxx> <20070425215843.GB8900@xxxxxxxxxxxxxxxxx> <7c737f300704251526m48df5c7dk6d32b340547e012d@xxxxxxxxxxxxxx> <17393e3e0704251538h10a32ff4xff95bb875d8ed193@xxxxxxxxxxxxxx> <7c737f300704251619y2566090cke411902726c27eec@xxxxxxxxxxxxxx> <7c737f300709110052t5797209w8ac77cd4d3aa6c3f@xxxxxxxxxxxxxx>
On Tue, 11 Sep 2007, Alexy Khrabrov wrote:
A while ago I asked about generalization of the nested command in find
-exec. What if I have to execute a random series of shell commands for
each file found by find and given to exec -- how should I package the
series under zsh? I tried -exec (cmd1; cmd2; cmd3) and it seems not to
work -- find complains about ( and ) and loses ; ... Is it a
shell-sensitive problem or find-specific?
================
i'm sure there's other ways to do this, but i do something like this...
find /path -param | while read n
do
cmd1 $n ; cmd2 $n
cmd3 $n
done
as long as there aren't white spaces in the output of find, everything
stays simple. off the top of my head, i think that white spaces can be
handled by double-quoting references to $n.
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"I tried marijuana once. I did not inhale."
-- William J. Clinton, 30 Mar 1992
"I did not have sexual relations with that
woman, Miss Lewinsky."
-- William J. Clinton, 26 Jan 1998
Messages sorted by:
Reverse Date,
Date,
Thread,
Author