aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-07-10 16:04:36 +1200
committerTom Ryder <tom@sanctum.geek.nz>2018-07-10 16:04:36 +1200
commitf30b357acdf0c61ef74fbb986c9fb3f54ab85323 (patch)
treef9c4a0565593f072b2c6479419424929d31e9041
parentMerge branch 'release/v2.0.0' (diff)
downloadnwatch-f30b357acdf0c61ef74fbb986c9fb3f54ab85323.tar.gz
nwatch-f30b357acdf0c61ef74fbb986c9fb3f54ab85323.zip
Correct logic error in Awk filter
-rwxr-xr-xnwatch10
1 files changed, 6 insertions, 4 deletions
diff --git a/nwatch b/nwatch
index c981fbc..e44da1e 100755
--- a/nwatch
+++ b/nwatch
@@ -71,16 +71,18 @@ done
# Write diff to stdout if it exists (not an error if it doesn't)
if [[ -r $diff ]] ; then
- awk '/^[-+]Not shown: / { next }
+ awk '
+/^[-+]Not shown: / { next }
/^[-+]/ { diff = 1 }
NF { lines[++l] = $0 }
function write() {
if (diff) {
- for (l in lines)
- print lines[l]
+ for (n = 1; n <= l; n++)
+ print lines[n]
print ""
+ diff = 0
}
- diff = l = 0
+ l = 0
}
!NF { write() }
END { write() }