‘find -exec’ a shell function in Linux

Is there a way to get find to execute a function I define in the shell?

For example:

dosomething () {
  echo "Doing something with $1"
}
find . -exec dosomething {} \;

The result of that is:

find: dosomething: No such file or directory

Is there a way to get find‘s -exec to see dosomething?

15 Answers
15

Leave a Comment