linux - find -exec a shell function? -


is there way find execute function define in shell? example:

dosomething () {   echo "doing $1" } find . -exec dosomething {} \; 

the result of is:

find: dosomething: no such file or directory 

is there way find's -exec see dosomething?

since shell knows how run shell functions, have run shell run function. need mark function export export -f, otherwise subshell won't inherit them:

export -f dosomething find . -exec bash -c 'dosomething "$0"' {} \; 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -