From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7541 invoked by alias); 23 Aug 2014 19:23:42 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19033 Received: (qmail 17037 invoked from network); 23 Aug 2014 19:23:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <140823122400.ZM23622@torch.brasslantern.com> Date: Sat, 23 Aug 2014 12:24:00 -0700 In-reply-to: <20140823190313.0286796f@pws-pc.ntlworld.com> Comments: In reply to Peter Stephenson "Re: zsh array subscripting with ksh comp behaviour" (Aug 23, 7:03pm) References: <20140823190313.0286796f@pws-pc.ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh Users Subject: Re: zsh array subscripting with ksh comp behaviour MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 23, 7:03pm, Peter Stephenson wrote: } } Hence you can test directly for this feature. As long as the shell } isn't old enough that the special parameters used by the new completion } system are absent, } } zmodload -i zsh/parameter } print ${+options[kshzerosubscript]} It's too bad that [[ -o there_is_no_such_option ]] is a critical error rather than returning some kind of falsehood, but you can always test in any version of the shell with if ( [[ -o kshzerosubscript ]] ) >&/dev/null then print KSH_ZERO_SUBSCRIPT else print not KSH_ZERO_SUBSCRIPT fi Unfortunately this isn't all you need in this case, because the old behavior occurs when EITHER (a) the option doesn't exist OR (b) the option is set. So you end up with something like if ( setopt kshzerosubscript ) >&/dev/null && [[ ! -o kshzerosubscript ]] then print New zero subscript behavior else print Old zero subscript behavior fi