bash read & piping
Say Temp.txt contains the single line
RandomText
The command
read -r line < Temp.txt
sets $line to "RandomText", but
cat Temp.txt | read -r line
does not. However,
cat Temp.txt | while read -r line ; do echo "$line" ; done
works.
Why are they different? Isn't "read" reading form stdin in all cases?
|