Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Complex forms deprecated?
- X-seq: zsh-users 11563
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Complex forms deprecated?
- Date: Wed, 13 Jun 2007 09:28:09 -0700
- In-reply-to: <17393e3e0706130811s7f965e8dhc4099b0ea9b1f4bb@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20070611144016.GB5245@xxxxxxxxxxxxxxxxxxxxx> <466FAB58.5090103@xxxxxxxxxxxxxxxxxx> <20070613134247.GA13590@xxxxxxxxxxxxxxxxxxxxx> <17393e3e0706130811s7f965e8dhc4099b0ea9b1f4bb@xxxxxxxxxxxxxx>
On Jun 13, 11:11am, Matt Wozniski wrote:
}
} Not to mention that, to me at least, the rules about what can be used
} as the delimiter where are kinda fuzzy.
They're not fuzzy if you really understand the shell grammar. Confusing,
maybe, but not fuzzy.
} For instance, both
} if {true} {echo good} else {echo bad}
} and
} if (true) {echo good} else {echo bad}
} work, but
} if (true) (echo good) else (echo bad)
} doesn't work...
Braces denote blocks that are executed in the current shell. Parens
denote blocks that are executed in a forked subshell. The body of the
if statement has to be a current shell construct, and the conditions
of the if statement have to form a list [in the shell grammar sense
of "list"] of valid shell commands. The first two both work because
both {true} and (true) are valid shell commands; the last does not
work because (echo good) is not a current shell construct and two
subshells in a row is not a valid list.
Even that is a paraphrase; the deeper reason has to do with "{" being
a "reserved word" in the grammar whereas "(" is merely a token, but it's
easier to follow the reasoning if you think about current vs. subshell.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author