-
-
Save linknum23/88aedaa238960d0805a4b10f2fef96bf to your computer and use it in GitHub Desktop.
bash helper, run a command x number of times
This file contains 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
#!/bin/bash | |
# run bash command x number of times | |
# ie. 'runx 10 echo "Hello"' will print Hello 10 times | |
# partially from: https://stackoverflow.com/questions/3737740/is-there-a-better-way-to-run-a-command-n-times-in-bash | |
function runx() { | |
for _ in $(seq "$1"); do | |
eval ${*:2} | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment