#!/bin/sh

# This file is maintained at http://git.mdcc.cx/draai

# joostvb@hille:~% while sleep 2; do cat /tmp/c; ( clear; draai peek ) >/tmp/c; done
# joostvb@hille:~/arch/draai-wd/script% DR_SLEEP=5 ./dr_watch draai peek

set -e

command=$@

tmpfile=$(mktemp -t dr_watch.XXXXXXXX)
trap 'rm $tmpfile' EXIT

sleep=${DR_SLEEP:-2}

while sleep $sleep
do
    (clear; $command) >$tmpfile
    cat $tmpfile
done

