A key element to consider how to choose the right form is variable visibility.
result=""find . -type f | while read linedo result="$result $line"doneecho "result pipe=$result"while read linedo result="$result $line"done < <(find . -type f)echo "result redirect input=$result"
gives the result in a directory that contains a, b, and c files
result pipe=result redirect input= ./c ./b ./a
"result pipe" will always be empty in the first form because the while loop executes in a secondary process."result redirect input" will give the list of files because the while loop executes in the current process.