Check out these links for details on how to handle this issue:
In a nutshell, you have to be very careful how you handle the output of commands, particularly ones that generate lists of filenames. Word-splitting can cause all sorts of problems if you don't do it right.
solution is better, but still not completely safe as written. You should always use the -print0
option, and the corresponding syntax in the reading application. This is also detailed in the above links.
Finally, beware of this common pipe subshell pitfall: