about summary refs log tree commit diff
path: root/nqtail.sh
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2024-07-03 17:55:45 +0200
committerLeah Neukirchen <leah@vuxu.org>2024-07-03 17:58:18 +0200
commit2bb551efd8b3e50d715482a8f3b89f88bae74397 (patch)
treed380e8ffaba4e634b6e518480f91f2f37bad72be /nqtail.sh
parente5861199e018fcc6537fbd4a522aea1f75ec0d4e (diff)
downloadnq-master.tar.gz
nq-master.tar.xz
nq-master.zip
Rename fq -> nqtail, tq -> nqterm HEAD v1.0 master
There's only so many two letter binaries that can exist at the same time.

A newer project, called fq, arrived and is clashing with nq in many
packaging systems, and nqtail is a fine name too.
Diffstat (limited to 'nqtail.sh')
-rwxr-xr-xnqtail.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/nqtail.sh b/nqtail.sh
new file mode 100755
index 0000000..d2d3816
--- /dev/null
+++ b/nqtail.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# nqtail - tail -F the queue outputs, quitting when the job finishes
+
+tailed=false
+for f in ${NQDIR:-.}/,*; do
+	if ! nq -t $f; then
+		tailed=true
+		printf '==> %s\n' "$f"
+		tail -F $f & p=$!
+		nq -w $f
+		kill $p
+	fi
+done
+
+if ! $tailed; then
+	cat $f
+fi