Skip to content

Instantly share code, notes, and snippets.

@wayneeseguin
Forked from metaskills/gist:604964
Created September 30, 2010 17:31
Show Gist options
  • Select an option

  • Save wayneeseguin/604965 to your computer and use it in GitHub Desktop.

Select an option

Save wayneeseguin/604965 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
cloop () {
# First parameter is $1, second is $2, etc...
# If you want to capture all arguments use "$@"
# Here we declare a local variable promoting clarity
local command="$@"
# ':' denotes true in shell scripting.
while : ; do
# Quoting can be very important, use liberally.
$command
# Naptime, yay!
sleep 5
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment