busybox awk doesn't allow print statements in for loop head

Steffen Nurpmeso steffen at sdaoden.eu
Mon Oct 30 18:29:10 UTC 2023


Oğuz wrote in
 <CAH7i3Lo7ONeVneMOLvhzJ_rYBxBPScKYCQ58obR4jb3jMGXi4g at mail.gmail.com>:
 |Reproduce by:
 |
 |     busybox awk 'BEGIN{for(print 5;0;);}'
 |
 |POSIX allows a print statement on both sides of the loop condition, so
 |this should print 5 (and does so with GNU awk). But it fails with this
 |error message instead:
 |
 |    awk: cmd. line:1: Unexpected token

Have you reported this for mawk, too?

  $ mawk 'BEGIN{for(print 5;0;);}'
  mawk: line 1: syntax error at or near print
  mawk: line 1: extra ')'

  Send bug reports, comments, questions, etc. to

          Thomas E. Dickey <dickey at invisible-island.net>
          https://invisible-island.net/mawk/

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


More information about the busybox mailing list