bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gawk misparses $expr++ if expr ends in ++


From: Paul Eggert
Subject: gawk misparses $expr++ if expr ends in ++
Date: Fri, 06 Jan 2006 14:02:17 -0800
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Here's an example of the problem:

$ gawk 'BEGIN{a=3}{print $$a++++}'
gawk: {print $$a++++}
gawk:               ^ syntax error

But it's not a syntax error, as the expression conforms to the POSIX
spec: it should be treated like '$($a++)++'.

Mawk, Solaris awk (old awk), and Solaris nawk all accept the
expression.  For example:

$ echo '3 4 5 6 7 8 9' | nawk 'BEGIN{a=3}{print $$a++++}'
7

This is with gawk 3.1.5 on Solaris 8 (sparc).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]