bpftools icon indicating copy to clipboard operation
bpftools copied to clipboard

Fix awk assignment instead of comparisson

Open patsie75 opened this issue 4 years ago • 0 comments

if (n=0) is always 'falsey' since assignment results to the value being assigned (in case of 0 that would be 0, which in awk is considered 'falsey')

~/git/cloudflare/bpftools$ awk 'BEGIN { if (n=0) print (n=0) }'
~/git/cloudflare/bpftools$ awk 'BEGIN { if (n=1) print (n=1) }'
1
~/git/cloudflare/bpftools$ awk 'BEGIN { if (n=2) print (n=2) }'
2

patsie75 avatar Aug 18 '21 09:08 patsie75