echo -e "10\n20\n100\n200" > file.txt
cat file.txt | \
while read line
if test $line -gt 100
echo "Inside while loop number=$number"
echo "Outside while loop number=$number"
The output of this script is
Inside while loop number=200
Outside while loop number=0
Why the variable $number is losing its value outside while loop
even though it's a global value?