From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25275 invoked by alias); 25 Apr 2018 10:57:58 -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: List-Unsubscribe: X-Seq: 23366 Received: (qmail 11901 invoked by uid 1010); 25 Apr 2018 10:57:58 -0000 X-Qmail-Scanner-Diagnostics: from dogbert.mscha.org by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(31.25.103.164):SA:0(-1.9/5.0):. Processed in 0.54438 secs); 25 Apr 2018 10:57:58 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: zsh@mscha.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at dogbert Subject: Re: Check for minimal ZSH version in shell script To: zsh-users@zsh.org References: <405bbbd4-c372-c15e-5cf6-b8025460e527@mscha.com> <20180425112954.0ea362d6@camnpupstephen.cam.scsc.local> From: Michael Schaap Message-ID: <18a35f29-103b-e8d7-360b-b1478b99d0ea@mscha.com> Date: Wed, 25 Apr 2018 12:57:52 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180425112954.0ea362d6@camnpupstephen.cam.scsc.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US On 25-Apr-18 12:29, Peter Stephenson wrote: > On Wed, 25 Apr 2018 12:04:45 +0200 > Michael Schaap wrote: >> Is there a good way to test for a minimal ZSH version in a shell >> script? >> >> I tried >>     if [[ $ZSH_VERSION -ge 5.3]] then >>         echo yes >>     fi >> but that fails if the version has more than one decimal point (e.g. >> 5.5.1). > You should be able to do > > autoload -Uz is-at-least > if is-at-least 5.3; then > ... > fi Thanks, Peter (and Daniel), perfect!  - Michael