summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid VaĊĦek <david.vasek@nic.cz>2023-02-06 13:03:14 +0100
committerDaniel Salzman <daniel.salzman@nic.cz>2023-02-07 13:00:24 +0100
commita9d42fdafad815c86e6e2063a39569f051304a53 (patch)
tree842af29864b895f89afa457cd0ce4b5cc71e4150
parentdistro/rpm: fix destination path for cz.nic.knotd.conf (diff)
downloadknot-a9d42fdafad815c86e6e2063a39569f051304a53.tar.xz
knot-a9d42fdafad815c86e6e2063a39569f051304a53.zip
samples: dbus_client.sh -- improve compatibility when mawk is used
Turn off the default input buffering in mawk.
-rwxr-xr-xsamples/dbus_client.sh10
1 files changed, 9 insertions, 1 deletions
diff --git a/samples/dbus_client.sh b/samples/dbus_client.sh
index 551e22628..d713332ac 100755
--- a/samples/dbus_client.sh
+++ b/samples/dbus_client.sh
@@ -20,8 +20,16 @@ cb() {
esac
}
+awk="awk"
+
+# If awk is mawk, turn off input buffering.
+if ($awk -Wv 2>&1 | grep -q "mawk") && \
+ ($awk -W interactive > /dev/null 2>&1); then
+ awk=${awk}" -W interactive"
+fi
+
gdbus monitor --system --dest cz.nic.knotd --object-path /cz/nic/knotd \
- | awk '/^\/cz\/nic\/knotd/ {
+ | $awk '/^\/cz\/nic\/knotd/ {
gsub("cz.nic.knotd.events.", "", $2);
tmp="";
for(i=3;i<=NF;++i) {