Skip to content

Instantly share code, notes, and snippets.

@quartzjer
Last active April 8, 2021 18:58
Show Gist options
  • Save quartzjer/acfea3d26ce13b8554d576b6a75848f6 to your computer and use it in GitHub Desktop.
Save quartzjer/acfea3d26ce13b8554d576b6a75848f6 to your computer and use it in GitHub Desktop.
simple shell wrapper to run any command in a loop
#!/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