My Scripts.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bin/x

25 lines
286 B

#!/usr/bin/env bash
# Usage: x n ARGS...
# Author: Skiqqy
usage()
{
cat << EOF
Exec ARGS n times
Usage: x n ARGS...
EOF
exit "${1:0}"
}
[ $# -lt 2 ] && usage 1
! [[ "$1" =~ ^[0-9]+$ ]] && usage 1
n="$1"
shift 1
for ((i=0; i < "$n"; i++))
do
eval "$*" # Eval is evil
done