Skip to content

Instantly share code, notes, and snippets.

@iwill
Created April 8, 2013 14:08
Show Gist options
  • Save iwill/5337027 to your computer and use it in GitHub Desktop.
Save iwill/5337027 to your computer and use it in GitHub Desktop.
repeat for bash like csh repeat
#! /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