Hello,
it is because when you use a pipe bash start a subshell to execute the while read ...
and so you are not under the scope of your ZIP and FILE variables when you try to echo them and then you get null.
To avoid this you can use a 'for' instead :
Code:
FILENAME=test.txt
count=0
for LINE in "$(cat $FILENAME)"
do
count=`expr "$count" + 1`
case $count in
"1") ZIP=$LINE;;
"2") FILE=$LINE;;
*)
esac
done
echo $ZIP
echo $FILE