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

Empty sublist in "if"



On Feb 12,  6:14am, Daniel Shahaf wrote:
}
} % if false; then if true; fi 
} % setopt noshortloops 
} % if false; then if true; fi 
} zsh: parse error near `fi'
} 
} I'm guessing the second 'if' is parsed using the SHORT_LOOPS syntax,
} with an empty sublist.  I'm not sure whether that's a bug: is the
} sublist in the SHORT_LOOPS syntax allowed to be null?

Hrm.

    if true; then fi

works, so yes, the sublist is allowed to be empty.  Still, the original
example seems a pretty questionable special case, and e.g. bash does
not allow an empty sublist there.

Of course zsh also allows empty braces and empty subshell parens, so ...



Messages sorted by: Reverse Date, Date, Thread, Author