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? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -