You need to use curly braces when you have more than one digit.
ARGX=${10}
etc. (Note that you don't need quotation marks around a parameter expansion that is the entire right side of an assignment statement.) Without the braces, $10
is interpreted as $1
followed by a literal 0
.
You can also use braces for the single-digit arguments (as well as any other shell parameter names), just for consistency. But with double-digit argument numbers, they're a necessity.
Once you get to the point that you have that many parameters to something, though, it might be worth looking into some sort of explicit naming scheme. Perhaps you could use option syntax, with something like func -name "$name" -text "$text"
, etc. Then you could do something like this (assuming bash >= 4):
declare -A args=()
while (( $# )); do
case "$1" in -*) key="${1#-}";;
*) args[$key]="$1";;
esac
shift
done
# now the name is ${args[name]}, text is ${args[text]}, etc.