Last active
April 8, 2021 18:58
-
-
Save quartzjer/acfea3d26ce13b8554d576b6a75848f6 to your computer and use it in GitHub Desktop.
simple shell wrapper to run any command in a loop
This file contains hidden or 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 | |
re='^[0-9]+$' | |
if ! [[ $1 =~ $re ]] ; then | |
echo "first arg $1 must be number of seconds to wait between loops" >&2; exit 1 | |
fi | |
count=0 | |
while [ true ] | |
do | |
date | |
$2 $3 $4 $5 $6 $7 $8 $9 | |
count=$(($count+1)) | |
echo "loop $count sleeping $1" | |
sleep $1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment