aboutsummaryrefslogtreecommitdiff
path: root/bin/clrd.sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-04-05 20:06:39 +1200
committerTom Ryder <tom@sanctum.geek.nz>2017-04-05 20:46:47 +1200
commitc8ab406749124d2e762ad5cf53963070113afd0f (patch)
tree54c9721a06957ebe7098a211eea803b0230c0f5d /bin/clrd.sh
parentHandle POSIX correctness in ~/.bash_profile (diff)
downloaddotfiles-c8ab406749124d2e762ad5cf53963070113afd0f.tar.gz
dotfiles-c8ab406749124d2e762ad5cf53963070113afd0f.zip
Apply runtime shebanging to POSIX shell
Diffstat (limited to 'bin/clrd.sh')
-rw-r--r--bin/clrd.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/clrd.sh b/bin/clrd.sh
new file mode 100644
index 00000000..bf239033
--- /dev/null
+++ b/bin/clrd.sh
@@ -0,0 +1,15 @@
+# Clear the screen and read a file as it's written line-by-line
+self=clrd
+
+# Check we have an input file and are writing to a terminal
+if [ "$#" -ne 1 ] ; then
+ printf >&2 '%s: Need input file\n' "$self"
+ exit 2
+elif ! [ -t 1 ] ; then
+ printf >&2 '%s: stdout not a terminal\n' "$self"
+ exit 2
+fi
+
+# Clear the screen and start tailing out the file
+clear
+tail -f -- "$@"