When I try to use the read command in Bash like this:
read
echo hello | read str echo $str
Nothing echoed, while I think str<
str<
The value disappears since the read command is run in a separate subshell: Bash FAQ 24