added watchit

This commit is contained in:
Alexander Bocken 2020-07-31 16:39:16 +02:00
parent c680720b44
commit 42f3a6052d

15
.local/bin/tools/watchit Executable file
View File

@ -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