Hi,
Why can't I change the value of variable after while loop?
#!/bin/sh
A="cde"
cat /etc/passwd | while read line; do
A="abc" && echo $A
done
echo $A
bash-2.05$ ./test.sh
abc
abc
abc
abc
abc
abc
abc
abc
abc
abc
abc
abc
abc
abc
cde <-- The value of $A hasn't been changed!
Is it a bash bug?
--
w3 <w3@hert.org>
Key ID = 0x5C034369
Key fingerprint = CA07 579E 56A6 9B60 C20E 5B5A 09CE 808A 5C03 4369
http://www.hert.org