Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Shell confusion over positional arguments



On Mon, Mar 10, 2025 at 09:07:44 -0700, Brian Buhrow wrote:

> The issue seems to be a change in the way command line arguments are
> assigned to the $number variables, i.e. $1, $2, $3, etc.

See the last example below in:

  2.5.1 Positional Parameters

  A positional parameter is a parameter denoted by a decimal
  representation of a positive integer.  The digits denoting the
  positional parameters shall always be interpreted as a decimal
  value, even if there is a leading zero.  When a positional parameter
  with more than one digit is specified, the application shall enclose
  the digits in braces (see 2.6.2 Parameter Expansion).

  Examples:

    "$8", "${8}", "${08}", "${008}", etc. all expand to the value of the eighth positional parameter.
    "${10}" expands to the value of the tenth positional parameter.
    "$10" expands to the value of the first positional parameter followed by the character '0'.

-uwe


Home | Main Index | Thread Index | Old Index