Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

EOF exiting shell



Two queries regarding exiting the shell via ^D:

  - The info pages say that even if IGNOREEOF is set, the shell will
    exit after ten EOFs, but in zle_main.c it looks like it needs to
    happen 20 times (although for me it never exits with IGNOREEOF set).

  - More importantly, if you exit via EOF, it exits with the last
    value of $? as the exit code.  This may be deliberate, but it's
    quite annoying for me; I have /bin/sh as my default shell, and
    then this gets called by my .bash_profile:

      switch_shell () {
        if [ -x $MYSHELL ] && [ -z "$NO_ZSH" ]; then
          # we do this rather than exec() just in case $MYSHELL fails to
        run.
          $MYSHELL -d "$@" && exit
        fi
      }

    where $MYSHELL points to a CVS install of zsh, which could
    conceivably be broken.  This way I guarantee myself a usable shell
    without some annoying `Run zsh [Y/n]?' sort of prompt every time I
    pop up a new terminal.  However, if in the successfully invoked
    zsh I hit ^D after doing something that sets $? != 0, that means
    that I fall back into bash.  No great hardship, but would be nice
    if it didn't happen.  Is there any reason why EOF couldn't set $?
    to 0 before exiting?

Thanks,

Adam



Messages sorted by: Reverse Date, Date, Thread, Author