Executing user defined function in a find -exec call

view story

http://unix.stackexchange.com – I'm on Solaris 10 and I have tested the following with ksh(88), bash(3.00) and zsh(4.2.1). The following code doesn't yield any result: function foo { echo "Hello World" } find somedir -exec foo \; The find does match several files (as shown by replacing -exec ... with -print), and the function works perfectly when called outside from the find call. Here's what the man find page say about -exec: -exec command True if the executed command returns a zero value as exit status. The end of command must be punctuated by an escaped (HowTos)