Using Shell Functions in "find"
23 May 2007
- You have to export the function since 'find' starts a new shell and if you don't export the function it won't be available for the sub-shell.
- You should call the function with 'bash -c' since your function is not a name for an executable binary.
The script should be something like this:
#!/bin/bash function mytest { echo "mytest $1" } export -f mytest find . -exec bash -c "mytest {}" \;
blog comments powered by Disqus