= Shift built-in
:encoding: UTF-8
:lang: en
//:title: Yash manual - Shift built-in

The dfn:[shift built-in] removes some
link:params.html#positional[positional parameters] or
link:params.html#arrays[array] values.

[[syntax]]
== Syntax

- +shift [-A {{array}}] [{{count}}]+

[[description]]
== Description

The shift built-in removes the first {{count}}
link:params.html#positional[positional parameters] or
link:params.html#arrays[array] values, where {{count}} is specified by the
operand.

[[options]]
== Options

+-A {{array}}+::
+--array={{array}}+::
Remove first {{count}} values of {{array}} instead of positional parameters.

[[operands]]
== Operands

{{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.

[[exitstatus]]
== Exit status

The exit status of the shift built-in is zero unless there is any error.

[[notes]]
== Notes

The shift built-in is a link:builtin.html#types[special built-in].

The number of positional parameters can be obtained with the
link:params.html#sp-hash[+&#35;+ special parameter].
The number of array values can be obtained with +$&#123;{{array}}[&#35;]}+.

The POSIX standard defines no options for the shift built-in;
the built-in accepts no options in the link:posix.html[POSIXly-correct mode].

Negative operands are not allowed in the POSIXly-correct mode.

// vim: set filetype=asciidoc textwidth=78 expandtab:
