From 42f3a6052d3da6706fece1bb28eb274afa13309a Mon Sep 17 00:00:00 2001 From: Alexander Bocken Date: Fri, 31 Jul 2020 16:39:16 +0200 Subject: [PATCH] added watchit --- .local/bin/tools/watchit | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 .local/bin/tools/watchit diff --git a/.local/bin/tools/watchit b/.local/bin/tools/watchit new file mode 100755 index 0000000..7ec93dd --- /dev/null +++ b/.local/bin/tools/watchit @@ -0,0 +1,15 @@ +#!/bin/sh +HOME=$(tput cup 0 0) +ED=$(tput ed) +EL=$(tput el) +printf '%s%s' "$HOME" "$ED" +while true +do + ROWS=$(tput lines) + COLS=$(tput cols) + CMD="$*" + ${SHELL:=sh} -c "$CMD" | head -n $ROWS | while IFS= read LINE; do + printf '%-*.*s%s\n' $COLS $COLS "$LINE" "$EL" + done + printf '%s%s' "$ED" "$HOME" +done