You can make this proof against files with newlines in their names, if you wish, by using a nullbyte delimiter (that being the only character which cannot appear in a *nix filepath):
find ... -print0 | while read -d '' -r dir
do
something with "$dir"
done
You will also find using $() instead of backticks to be more versatile and easier. They can be nested much more easily and quoting can be done much more easily. This contrived example will illustrate these points:
echo "$(echo "$(echo "hello")")"
Try to do that with backticks.






Leave a comment