Hi everybody,
I am having a strange problem.
If I write something like:
cat file_of_data | while read x
do
BLAH BLAH BLA
done
echo "x=$x"
I have this output "x="
If I write, WITHOUT CHANGING ANYTHING IN file_of_data:
while read x
do
BLAH BLAH BLAH
done < file_of_data
echo "x=$x"
The output is "x=last_value_read".
Looks like a sudden death of the process writing in the pipe whipes out in the variables changed in the do... done block
Any idea?
I am having a strange problem.
If I write something like:
cat file_of_data | while read x
do
BLAH BLAH BLA
done
echo "x=$x"
I have this output "x="
If I write, WITHOUT CHANGING ANYTHING IN file_of_data:
while read x
do
BLAH BLAH BLAH
done < file_of_data
echo "x=$x"
The output is "x=last_value_read".
Looks like a sudden death of the process writing in the pipe whipes out in the variables changed in the do... done block
Any idea?