Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokland/1162599 to your computer and use it in GitHub Desktop.
Save tokland/1162599 to your computer and use it in GitHub Desktop.
A bash function that executes a command
# Usage:
# $loopc 3 echo 'hello world'
# hello world
# hello world
# hello world
#
function loopc {
LIMIT=$1
shift 1
for((i=0; i<$LIMIT; i++)); do
"$@"
done
}
# Usage:
# $loopc 3 echo 'hello world'
# hello world
# hello world
# hello world
#
function loopc {
local LIMIT=$1
shift 1
for((i=0; i<$LIMIT; i++)); do
"$@"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment