The usual way is to use a pipe:

find . -name '*.jpg' | while read f do;
    some_command "$f"
done

There are two problems here. First, this won’t work if paths have spaces or other blank characters in them. Second, bash actually forks a sub-process when using the pipe, some everything that is done within the “while” loop is executed in a sub-process. If variables are set in this loop, they won’t be available outside the loop.

Here is a better way:

a=
i=0
while IFS= read -r -d $'\0' f; do
    a[i++]="$f"
done < <(find . -print0)
 
for item in "${a[@]}"; do
    echo "$item"
done

The `-print0` option for `find` will separate entries using the null character instead of the newline character, thus allowing spaces and other blanks in path names. Using redirection in the example above runs `find` in a subshell, rather than the loop itself, thus preserving variables after the loop.

I work as a freelancer, so if you don’t want to do that kind of things yourself or don’t have the time, just drop me a line to hire me.