zsh-users
 help / color / mirror / code / Atom feed
* Check for minimal ZSH version in shell script
@ 2018-04-25 10:04 ` Michael Schaap
  2018-04-25 10:24   ` Daniel Shahaf
  2018-04-25 10:29   ` Peter Stephenson
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Schaap @ 2018-04-25 10:04 UTC (permalink / raw)
  To: zsh-users

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).

Thanks,

  - Michael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Check for minimal ZSH version in shell script
  2018-04-25 10:04 ` Check for minimal ZSH version in shell script Michael Schaap
@ 2018-04-25 10:24   ` Daniel Shahaf
  2018-04-25 10:29   ` Peter Stephenson
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2018-04-25 10:24 UTC (permalink / raw)
  To: zsh-users

Michael Schaap wrote on Wed, 25 Apr 2018 12:04 +0200:
> Is there a good way to test for a minimal ZSH version in a shell script?
> 

See is-at-least in zshcontrib(1) (you need to autoload it before it's available in a script).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Check for minimal ZSH version in shell script
  2018-04-25 10:04 ` Check for minimal ZSH version in shell script Michael Schaap
  2018-04-25 10:24   ` Daniel Shahaf
@ 2018-04-25 10:29   ` Peter Stephenson
  2018-04-25 10:57     ` Michael Schaap
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2018-04-25 10:29 UTC (permalink / raw)
  To: zsh-users

On Wed, 25 Apr 2018 12:04:45 +0200
Michael Schaap <zsh@mscha.com> 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

pws



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Check for minimal ZSH version in shell script
  2018-04-25 10:29   ` Peter Stephenson
@ 2018-04-25 10:57     ` Michael Schaap
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Schaap @ 2018-04-25 10:57 UTC (permalink / raw)
  To: zsh-users

On 25-Apr-18 12:29, Peter Stephenson wrote:
> On Wed, 25 Apr 2018 12:04:45 +0200
> Michael Schaap <zsh@mscha.com> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-25 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180425101502epcas5p1fada2f6ce04b5f5be2d6abb54124d32f@epcas5p1.samsung.com>
2018-04-25 10:04 ` Check for minimal ZSH version in shell script Michael Schaap
2018-04-25 10:24   ` Daniel Shahaf
2018-04-25 10:29   ` Peter Stephenson
2018-04-25 10:57     ` Michael Schaap

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).