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

Re: padding.



On 11/02/17 10:14 PM, 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?

Well no one else has commented on it, but I don't know how it could not be a bug, tho this 'shortloops' must be there for a reason. Docs refer to the 'short form' of various constructs but what's the point of it here? I see the use with 'while', but with 'if' it seems trivial. I see it as just letting me get away with mistakes.

and:

$  if [ "$1" = "start" ]; then
         # if [ "$1" = 'null' ] && return
    fi

(no message)
That's expected.

Yes, it's just there as contrast for the questionable one.



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