The dfn:[shift built-in] removes some positional parameters or array values.
The shift built-in removes the first {{count}} positional parameters or array values, where {{count}} is specified by the operand.
- -A {{array}}
- --array={{array}}
-
Remove first {{count}} values of {{array}} instead of positional parameters.
- {{count}}
-
The number of positional parameters or array values to be removed.
It is an error if the actual number of positional parameters or array values is less than {{count}}. If omitted, the default value is one. If negative, the last -{{count}} positional parameters or array values are removed instead of the first ones.
The shift built-in is a special built-in.
The number of positional parameters can be obtained with the # special parameter. The number of array values can be obtained with ${{{array}}[#]}.
The POSIX standard defines no options for the shift built-in; the built-in accepts no options in the POSIXly-correct mode.
Negative operands are not allowed in the POSIXly-correct mode.