summaryrefslogtreecommitdiff
path: root/nocompile/bin/watch
blob: ccd94b35244657ed52cc73d5838b514d05ba3cf0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
sigwinch() {
 clear
 WIDTH=$(stty size | cut '-d ' -f2) 
}
trap sigwinch WINCH
sigwinch
if [ "_$DELAY" = "_" ];then
 DELAY=1
fi
while true;do
 printf "\x1b[7m" #reverse colors
 echo "running $* @ $(date)" | pad $WIDTH
 printf "\e[0m" #reset colors
 $* | pad
 sleep $DELAY
 printf "\x1b[H"
done