aboutsummaryrefslogtreecommitdiff
path: root/bin/max.awk
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-07-02 17:36:37 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-07-02 22:57:07 +1200
commit95276f25769a0607cda50041169197d0522b98ff (patch)
tree3a4738901390c94f76de6ee7b6394d39b4c1ed00 /bin/max.awk
parentCoerce seed to number (diff)
downloaddotfiles-95276f25769a0607cda50041169197d0522b98ff.tar.gz
dotfiles-95276f25769a0607cda50041169197d0522b98ff.zip
Lots of cleanup of awk scripts
Mostly inspired by suggestions from gawk --lint
Diffstat (limited to 'bin/max.awk')
-rw-r--r--bin/max.awk6
1 files changed, 2 insertions, 4 deletions
diff --git a/bin/max.awk b/bin/max.awk
index 11d4efd9..f6b84ead 100644
--- a/bin/max.awk
+++ b/bin/max.awk
@@ -1,8 +1,6 @@
# Get the maximum of a list of numbers
-{
- if (NR == 1 || $1 > max)
- max = $1
-}
+BEGIN { max = 0 }
+NR == 1 || $1 > max { max = $1 + 0 }
END {
if (!NR)
exit(1)