I'm trying to do something like the following:
for file in `find . *.foo` do somecommand $file done
But the command isn't working because $file is very odd. Because my directory tree has crappy file names (including spaces), I need to escape the
find command. But none of the obvious escapes seem to work:
-ls gives me the space-delimited filename fragments
-fprint doesn't do any better.
I also tried:
for file in "find . *.foo -ls
"; do echo $file; done
- but that gives all of the responses from find in one long line.
Any hints? I'm happy for any workaround, but am frustrated that I can't figure this out.