Quote:
Originally Posted by dinjo_jo
Hi ,
I'm trying to change the variable value in a while loop , however its not working it seems that the problem with subshells while reading the file.
#!/bin/sh
FLAG=0;
cat filename | while read data
do
FLAG=1;
done
echo $FLAG
Should display 1 instead displays 0
|
It will only display the value of FLAG as 1 when the condition is satisfied,that means there is some file you are trying to cat and reading lines. So check for the file first.
Thanks..