Behavior of while loop and for loop in unix script

view story

http://unix.stackexchange.com – I am trying to read user and server details from file tempo.txt and then check the disk space usage of the file system on that unix account using another script server_disk_space.sh.But I am not able to figure out why while loop is only working for first line and for loop is working fine.Please help me understand this. Using while loop #!/usr/bin/ksh while read line do r1=`echo $line | cut -d"#" -f1`; r2=`echo $line | cut -d"#" -f2`; apx_server_disk_space.sh $r2 $r1 done<tempo.txt Output 8 Using for loop #!/usr/bin/ksh for line in $(cat tempo.txt) do r1=`echo $line | cut -d"#" - (HowTos)