Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: `[[ -n $VAR ]]` equal to `[[ $VAR ]]`?
- X-seq: zsh-users 20121
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: `[[ -n $VAR ]]` equal to `[[ $VAR ]]`?
- Date: Thu, 9 Apr 2015 19:01:51 -0700
- In-reply-to: <mg78mg$vqb$1@ger.gmane.org>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <mg78mg$vqb$1@ger.gmane.org>
On Apr 10, 3:23am, Thorsten Kampe wrote:
} Subject: `[[ -n $VAR ]]` equal to `[[ $VAR ]]`?
}
} this is kind of a follow-up to
} http://www.zsh.org/mla/users/2011/msg00284.html .
Note 2011.
} Now my question is, isn't `[[ -n $VAR ]]` equivalent to `[[ $VAR ]]`?
} (`[[ -n ${VAR+stuff} ]]` equivalent to `[[ ${VAR+stuff} ]]`)
The answer is zsh-version-dependent.
In all releases prior to May 2014, [[ $var ]] was a parse error. In all
later releases, [[ $var ]] is the same as [[ -n $var ]]. That means
zsh 5.0.6 and later support the bash-equivalent syntax.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author