Skip to content

Instantly share code, notes, and snippets.

@thonixx
Last active December 21, 2015 16:38
Embed
What would you like to do?
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