aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-01-05 20:42:20 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-01-05 20:42:20 +1300
commit1ffb4b6811c3cff59b0acaed0e9e2aabe3291b3b (patch)
tree25245f00dce0e694c4b188d1a650a662ad496dec /bin
parentSlightly more idiomatic awk (diff)
downloaddotfiles-1ffb4b6811c3cff59b0acaed0e9e2aabe3291b3b.tar.gz
dotfiles-1ffb4b6811c3cff59b0acaed0e9e2aabe3291b3b.zip
Use more portable awk stderr write
The fork is a bit ugly, but it's only for printing a single error.
Diffstat (limited to 'bin')
-rw-r--r--bin/gwp.awk2
-rw-r--r--bin/med.awk2
-rw-r--r--bin/sec.awk2
3 files changed, 3 insertions, 3 deletions
diff --git a/bin/gwp.awk b/bin/gwp.awk
index 32fe97f2..976b5b84 100644
--- a/bin/gwp.awk
+++ b/bin/gwp.awk
@@ -23,7 +23,7 @@ BEGIN {
# Bailout function
function fail(str) {
- printf "%s: %s\n", self, str > "/dev/stderr"
+ printf "%s: %s\n", self, str | "cat >&2"
exit(1)
}
diff --git a/bin/med.awk b/bin/med.awk
index 8167f8dd..aee120cb 100644
--- a/bin/med.awk
+++ b/bin/med.awk
@@ -1,7 +1,7 @@
# Get the median of a list of numbers
{ vals[NR] = $1 }
NR > 1 && vals[NR] < vals[NR-1] && !warn++ {
- printf "med: Input not sorted!\n" > "/dev/stderr"
+ printf "med: Input not sorted!\n" | "cat >&2"
}
END {
# Error out if we read no values at all
diff --git a/bin/sec.awk b/bin/sec.awk
index 3ebf02b6..001b017d 100644
--- a/bin/sec.awk
+++ b/bin/sec.awk
@@ -6,7 +6,7 @@ BEGIN { FS = ":0*" }
# If no fields, too many fields, or illegal characters, warn, skip line, accrue
# errors
!NF || NF > 3 || /[^0-9:]/ {
- print "sec: Bad format" > "/dev/stderr"
+ print "sec: Bad format" | "cat >&2"
err = 1
next
}