aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-10-30 20:58:39 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-10-30 20:58:39 +1300
commit36636d4b55bc9189b013fd8ccacb12e8070232b3 (patch)
tree368b14b5e60afd5aee96d46f4033b10c971c76e3 /bin
parent8513d16d685369a3b2f3eaa7f4babfd070b94670 (diff)
downloaddotfiles-36636d4b55bc9189b013fd8ccacb12e8070232b3.tar.gz
dotfiles-36636d4b55bc9189b013fd8ccacb12e8070232b3.zip
Refactor min.awk to match max.awk
This is more idiomatic, and explicitly initialises the result variable.
Diffstat (limited to 'bin')
-rw-r--r--bin/min.awk6
1 files changed, 2 insertions, 4 deletions
diff --git a/bin/min.awk b/bin/min.awk
index c58a3a8f..18f65889 100644
--- a/bin/min.awk
+++ b/bin/min.awk
@@ -1,8 +1,6 @@
# Get the minimum of a list of numbers
-{
- if (NR == 1 || $1 < min)
- min = $1
-}
+BEGIN { min = 0 }
+NR == 1 || $1 < min { min = $1 + 0 }
END {
if (!NR)
exit(1)