Re: grammar

Peter Stephenson <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.