Skip to content

Instantly share code, notes, and snippets.

@thonixx

thonixx/loop-function.sh

Last active Dec 21, 2015
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
You can’t perform that action at this time.