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

Re: script within find



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