I’ve a shellscript, that I run from an NSTask, that I build dynamically. Everything works fine besides one thing:
If the filename contains a blank, it’s ignored by the find-command. I use it like that: ‘find -iname *.xxx’.
If the filename looks something like ‘aaa bbb.xxx’, than it’s not found.
Any help appreciated.
Regards,
Marcus
finddoes not care if your file names have spaces in them. That’s not your problem.If you’re actually calling it as typed in your question (
find -iname *.xxx), then the problem is that you need to quote the file name pattern to protect it from shell expansion:find -iname '*.xxx'. Note the quotes around the pattern; they’re essential.Otherwise, the problem is very likely in how you’re handling the file names you’re getting back. For example, this won’t work:
you’ll see that the backtick operator actually splits on spaces (or,
$IFS, actually) and you get back two “files”: ‘aaa’ and ‘bbb.xxx’.