Set input to non-interactive if -y or -n provided, and restore the shell.