oops endless loop in sh script