Bug 12591 - awk requires parentheses around expressions
Summary: awk requires parentheses around expressions
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.31.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-28 22:44 UTC by wolf+busybox
Modified: 2020-02-28 22:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wolf+busybox 2020-02-28 22:44:12 UTC
Following works in gawk

$ echo | awk -F. '{print $1 == 0 && $2 >= 7}'
0

however the same fails in busybox's awk

$ echo | busybox awk -F. '{print $1 == 0 && $2 >= 7}'
awk: cmd. line:1: Unexpected token

My understanding of https://pubs.opengroup.org/onlinepubs/009695399/utilities/awk.html#tag_04_06_13_16 is that the parentheses are optional there. When you add them, it starts to work:

$ echo | busybox awk -F. '{print ($1 == 0) && ($2 >= 7)}'
0