How to handle more than 10 parameters in shell

Ashitosh picture Ashitosh · Feb 6, 2011 · Viewed 74.4k times · Source

I am using bash shell on linux and want to use more than 10 parameters in shell script

Answer

Use curly braces to set them off:

echo "${10}"

You can also iterate over the positional parameters like this:

for arg

or

for arg in "$@"

or

while (( $# > 0 ))    # or [ $# -gt 0 ]
do
    echo "$1"
    shift
done