Created
September 29, 2017 18:21
-
-
Save Rycieos/89a334edbd9849ba359ba70fd5517ea8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Poor man's watch | |
if [ "$1" = "-n" ]; then | |
TIME=$2 | |
shift 2 | |
else | |
TIME=2 | |
fi | |
while :; do | |
clear | |
# Right justify date | |
printf "%*s\r" "$(tput cols)" "$(date)" | |
# Print time interval and command to be run | |
printf "Every %1.1fs: %s\n" "${TIME}" "$*" | |
$* | |
sleep $TIME | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment