Skip to content

Instantly share code, notes, and snippets.

@smullins7
Created May 7, 2014 16:01
Show Gist options
  • Save smullins7/d354bc51aa30eb9366d0 to your computer and use it in GitHub Desktop.
Save smullins7/d354bc51aa30eb9366d0 to your computer and use it in GitHub Desktop.
bash for.loop function, so I don't have to remember the for loop syntax...
function for.loop {
if [ $# -eq 0 ]
then
echo "Usage: for.loop <num-of-iterations> <command>"
return
fi
local iterations=${1}
local cmd=${@:2}
for i in $(seq 1 ${iterations}); do ${cmd}; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment