Skip to content

Instantly share code, notes, and snippets.

@thonixx
Last active December 21, 2015 16:38
Show Gist options
  • Save thonixx/6334658 to your computer and use it in GitHub Desktop.
Save thonixx/6334658 to your computer and use it in GitHub Desktop.
Run any command in a while loop
# loop function
# run any command in a while loop with 1 second sleep
function loop() {
if [ -z "$1" ]
then
return
fi
cmd="$1"
while true
do
bash -c "$cmd"
sleep 1
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment