'find -exec' a shell function in Linux
Jac's answer is great, but it has a couple of pitfalls that are easily overcome:
find . -print0 | while IFS= read -r -d '' file; do dosomething "$file"; done
This uses null as a delimiter instead of a linefeed, so filenames with line feeds will work. It also uses the -r
flag which disables backslash escaping, and without it backslashes in filenames won't work. It also clears IFS
so that potential trailing white spaces in names are not discarded.