Reprinted from: http://www.cnblogs.com/sheldonxu/archive/2012/06/25/2560770.html
In a shell script, you can get the nth parameter in a $n way, for example, a script named Paramtest:
#!/bin/bash
echo $
The result of executing./paramtest a B is to print out the 1th and 2nd parameters:
A b
However, if the script requires more than 10 parameters, it is problematic to write the numbers directly. For example, the script is:
#!/bin/bash
echo $ $ $4 $6 $7 $8 $9 $
Execute./paramtest a b c d e F g h i j, the result is as follows, the 10th parameter is incorrect:
A b c d e F g h I A0
It is clear that $ $1+0 is interpreted as a.
The workaround is simple, and the 10th parameter is added with curly braces:
#!/bin/bash
echo $ $4 $6 $7 $8 $9 ${10}
Execute again./paramtest a b c d e F g h i j, the result is correct:
A b c d e F g h i J
"Shell" gets the first + position parameter