Re: grammar

Peter Stephenson <[email protected]> Wed, 29 Apr 2026 17:10:19 +0100 (BST)
Newsgroups gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user
Message-ID <[email protected]>
> On 29/04/2026 16:59 BST Ray Andrews <[email protected]> wrote:
> I was going thru some old stuff and I came across something like this:
>
>  % if [[ $path ]] echo $path
>
>  ... it works, which makes me uncomfortable because it ain't good grammar.

You're basically correct, yes, it's an abbreviation.  Not entirely
logically, it's allowed by the SHORT_LOOPS option.

% if [[ -n string ]] echo string is stringy
string is stringy
% setopt noshortloops
% if [[ -n string ]] echo string is stringy
zsh: parse error near `echo'
% 

If you want to be purist you can turn that off, although of course it
does have other consequences.

pws