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

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -