Discussion: bash read & piping
Afficher un message
Vieux 26/07/2007, 03h56   #1
Mister.Fred.Ma@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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?

  Réponse avec citation
 
Page generated in 0,19457 seconds with 9 queries