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

Possible parsing bug with alternate for-loop syntax



17:44:25 <Mikachu> > for a (1) {echo hi}
17:44:26 <machabot> Mikachu: hi
17:44:29 <Mikachu> > for a (1) {a=hi}; echo $a
17:44:38 <machabot> Mikachu: Timeout (no output).
17:44:36 <Mikachu> > for a (1) {a=hi} }; echo $a
17:44:39 <machabot> Mikachu: hi}
17:45:17 <Mikachu> > for a (1) {builtin local a=hi}; echo $a
17:45:18 <machabot> Mikachu: hi
17:45:22 <Mikachu> > for a (1) {local a=hi}; echo $a
17:45:30 <machabot> Mikachu: Timeout (no output).
17:45:26 <Mikachu> nice
17:45:37 <Mikachu> you get the bug for reserved word local but not for
builtin local

The documentation does state the syntax is { list } with the space
included, but this still seemed somewhat surprising to me.

-- 
Mikael Magnusson



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