4 ms·
> The fact that most OSs have a POSIX compliant version of it You need to be cautious however, gnu awk can be somewhat inconsistent at times: try the followin
by kakwa_ 8y ago
> The fact that most OSs have a POSIX compliant version of it
You need to be cautious however, gnu awk can be somewhat inconsistent at times:
try the following on various distros (and also an *BSD) for example:
awk 'BEGIN {print "9.1" >= "8"}';
awk 'BEGIN {print "9.1" > "8"}';
awk 'BEGIN {print "9.1" < "8"}';
awk 'BEGIN {print "9.1" <= "8"}';
on OpenBDS, you get no output or a syntax error, on Debian, you get the correct result for < and <= in all cases, never for > (it's interpreted as a redirection), and >= only works with newer Debian versions (sid and maybe stretch).
I know that the fix is simple: just put some parenthesis (awk 'BEGIN {print ("9.1" <= "8")}'), but I was quite amused to discover that a few days ago.