[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to escape "find" result



On Sat, 30 Nov 2002 13:45:20 +1100
Cameron Hutchison <camh+dl@xdna.net> wrote:

> $ find . -name "*.txt" | while read f ; do
> > cmd1 "$f"
> > cmd2 "$f"
> > cmd3 "$f"
> > done
> 
> I've found that is the easiest way to use find when you have spaces in
> filenames. Dont forget the quotes arounf $f when you use it, or you get
> the same problem when running the commands (ie appears as two args
> instead of one).

This doesn't work when you have to update a variable inside the while
loop that you want to use afterwards, it apparently runs in a subshell.

-- 
Carlos Sousa
http://vbc.dyndns.org/



Reply to: