Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: `[[ -n $VAR ]]` equal to `[[ $VAR ]]`?



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