aboutsummaryrefslogtreecommitdiff
path: root/bin/rndl.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/rndl.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/rndl.awk')
-rw-r--r--bin/rndl.awk8
1 files changed, 6 insertions, 2 deletions
diff --git a/bin/rndl.awk b/bin/rndl.awk
index 8feb4f90..925235ee 100644
--- a/bin/rndl.awk
+++ b/bin/rndl.awk
@@ -7,7 +7,9 @@ BEGIN {
self = "rndl"
# Seed the random number generator
- "rnds 2>/dev/null" | getline seed
+ rnds = "rnds 2>/dev/null"
+ rnds | getline seed
+ close(rnds)
if (length(seed))
srand(seed + 0)
else
@@ -23,7 +25,9 @@ END {
# Check that we processed at least one line
if (!NR) {
- printf "%s: No lines found on input\n", self | "cat >&2"
+ stderr = "cat >&2"
+ printf "%s: No lines found on input\n", self | stderr
+ close(stderr)
exit(1)
}