Created
May 7, 2014 16:01
-
-
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...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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