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

Anonymous function syntax and "sh" emulation



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