Created
April 8, 2013 14:08
-
-
Save iwill/5337027 to your computer and use it in GitHub Desktop.
repeat for bash like csh repeat
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 | |
function repeat() { | |
if [[ $# < 2 ]]; then | |
echo "repeat: Too few arguments." | |
return 1 | |
else | |
n=$1 | |
shift | |
seq $n | xargs -I{} "$@" | |
fi | |
} | |
export -f repeat | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment