Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Anonymous function syntax and "sh" emulation
- X-seq: zsh-workers 36257
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Anonymous function syntax and "sh" emulation
- Date: Thu, 20 Aug 2015 21:16:38 -0700
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
This works in both zsh and sh emulation:
() { print hello; }
So does this:
function () { print hello; }
This works in zsh emulation but not in sh emulation:
function { print hello; }
The error is "parse error near `}'". If you write it as
function {
print hello
}
then the error is "parse error near `print'". Since this is the example
syntax in the "Anonymous Functions" subsection of the manual, it seems
that it either ought to work, or there ought to be a warning.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author