Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 4
    You can use "double-digit" parameters directly, just use braces: echo ${12} Commented Dec 9, 2013 at 18:19
  • Also, $# gives you the number of arguments. For example, with ./test.sh a b c, $# would evaluate to 3. Commented Dec 9, 2013 at 20:18
  • @glennjackman – should I be using the quotes around the parameter as in echo "${12}" or is the syntax sufficient as echo ${12}. What is the difference? Commented Jan 26, 2018 at 13:59
  • Using double quotes will prevent the shell from performing word splitting and filename expansion. Use of braces allows you to use double-digit positional parameters, and to disambiguate variable names from surrounding text. Commented Jan 26, 2018 at 14:38
  • Demo: set -- one two three four five six seven eight nine ten eleven "12 twelve"; printf "%s\n" "${12}"; printf "%s\n" ${12} Commented Jan 26, 2018 at 14:38