How to handle more than 10 parameters in shell

LinuxBashShellParameters

Linux Problem Overview


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

Linux Solutions


Solution 1 - Linux

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

Solution 2 - Linux

You can have up to 256 parameters from 0 to 255 with:

${255}

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAshitoshView Question on Stackoverflow
Solution 1 - LinuxDennis WilliamsonView Answer on Stackoverflow
Solution 2 - LinuxlukulukuView Answer on Stackoverflow