This is why you never use shell scripts for non-interactive tasks.