The following bash does not print out var text, which is confusing to me. How to print the value of text?
text=D
echo -e 'A\nB\nC' | while read aline; do
text=$aline
done
echo $text
the printout is D, but I want to print value C.
The following bash does not print out var text, which is confusing to me. How to print the value of text?
text=D
echo -e 'A\nB\nC' | while read aline; do
text=$aline
done
echo $text
the printout is D, but I want to print value C.