Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: IGNORE_EOF like in bash
- X-seq: zsh-users 3832
- From: Christoph Lange <langec@xxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: IGNORE_EOF like in bash
- Date: Thu, 26 Apr 2001 11:07:19 +0200 (CEST)
- Cc: zsh-users@xxxxxxxxxxxxxx
- In-reply-to: <1010426034956.ZM11913@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Reply-to: Christoph Lange <duke@xxxxxxxxxxxxxx>
> With your function, IGNOREEOF=3 will require four ^D to exit, or two ^D
> and then anything else, repeated four times (because it never starts
> __BASH_IGNORE_EOF over at three after the first call to this function).
>
> I think you want:
>
> bash-ctrl-d() {
> if [[ $CURSOR == 0 && -z $BUFFER ]]
> then
> [[ -z $IGNOREEOF || $IGNOREEOF == 0 ]] && exit
> if [[ $LASTWIDGET == bash-ctrl-d ]]
> then
> (( --__BASH_IGNORE_EOF <= 0 )) && exit
> else
> (( __BASH_IGNORE_EOF = IGNOREEOF-1 ))
> fi
> zle send-break
> else
> zle delete-char-or-list
> fi
> }
Thanks for correcting my hack. However, __BASH_IGNORE_EOF should be
initialized with the value of IGNOREEOF for a bash-like
implementation. IGNOREEOF=3 in bash means that EOF is ignored three
times. Only the 4th EOF is not ignored and exits the shell.
Christoph
--
Computer, n.: A device designed to speed and automate errors
Christoph Lange, langec@xxxxxx, http://www.cul.de/home/yaph/, ICQ #51191833
Messages sorted by:
Reverse Date,
Date,
Thread,
Author