Re: How to escape "find" result
On Fri, Nov 29, 2002 at 08:52:36PM -0500, Try KDE wrote:
> Hi,
>
> I'm trying to run the following script:
> for f in $(find . -name "*.txt"); do cmd1;cmd2;cmd3; done
> ,where cmd1, cmd2 and cmd3 are arbiturary commands. The problem is, if
> the found file names contain a space , for example "part1 part2.txt"
> will be interpreted as "part1" and "part2.txt". I'm thinkin an esacping
> tool may be able turn it into "part1\ part2.txt" before passing it to
> "for" loop. Any thought?
Does:
IFS="^M" && for f in $(find . -name "*.txt"); do cmd1; cmd2; cmd3; done
work? (replace ^M with real newline)
There's also the trick of:
for f in *.txt; do echo "$f" ; done
--
"...the plural of anecdote is [not?] data." - attrib. to George Stigler
Reply to: