Skip to content

Instantly share code, notes, and snippets.

@k8scat
Last active May 4, 2021 19:11
Show Gist options
  • Save k8scat/d315a50a687521056ba5a1da0ee767fa to your computer and use it in GitHub Desktop.
Save k8scat/d315a50a687521056ba5a1da0ee767fa to your computer and use it in GitHub Desktop.
Play `watch` in a shell script
#!/bin/sh
# while :; do clear; your_command; sleep 2; done
# usage: watch.sh "<your_command>" "<sleep_duration>"
d=${2:-2}
while :; do
clear
date
$1
sleep ${d}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment