Date: Sat, 05 Sep 2020 18:35:36 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 180328] awk(1) fails to treat var as integer Message-ID: <bug-180328-227-ZWzZK52EoQ@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-180328-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | previous in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=180328 Jason W. Bacon <jwb@freebsd.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jwb@freebsd.org --- Comment #4 from Jason W. Bacon <jwb@freebsd.org> --- I ran into something similar, also solved using if ( var1 + 0 < var2 ) For data read using getline, the behavior differs from mawk and gawk from ports. I'm not sure if this should be regarded as a bug, but it should at least be documented. Here's a minimal test case: BEGIN { x="10" y="9" printf("%s\n", x < y); # Always 1 x=10 y=9 printf("%s\n", x < y); # Always 0 getline x < "xy.txt" getline y < "xy.txt" printf("%s %s\n", x, y); # Prove we're using values from getline printf("%s\n", x < y); # awk 1, mawk and gawk 0 } xy.txt: 11 8 -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-180328-227-ZWzZK52EoQ>
