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