コマンド実行結果を while read する場合の注意点

some_command \

while read line

do
(do something)
result=(some variable)
done

echo $result

上記のようなコードを実行すると、最後の行の「echo $result」の実行結果は必ずNULL(空行)になってしまう。
おそらく、some_command とともに、while read の部分も子プロセスで実行されてしまうため、while read 内で変数を代入してもそれが元のプロセス上に反映されないためだろう。