Fix looping in shell script.