I'm trying to assign the output of a command to multiple variables, one per output "word". Doing (bash on linux)
echo foo bar baz | read FOO BAR BAZ
echo $FOO $BAR $BAZ
shows only empty strings. Doing
read FOO BAR BAZ < <(echo foo bar barz)
echo $FOO $BAR $BAZ
works as expected. What's wrong here? I thought using a pipe was the most obvious and right way to do that.