SHIFT(1)

NAME
shift - shift the positional parameters of an execline script

SYNOPSIS
shift [-n argn] [-b blockn] prog...

DESCRIPTION
shift shifts argn positional parameters, then blockn blocks. It then exec(3) s prog....

By default, argn and blockn are both zero; but if neither the -n nor the -b option is given, then argn is 1 and blockn is 0.

‘shift’ is a standard shell builtin. Be careful if you want to use it outside of an execline script.

The -b option is only useful to implement execline commands in the execline language. You shouldn't normally have to use it.

  Details

•   shift reads the number of “positional parameters” in the # environment variable. Let n be that number.

•   If the # environment variable is not set or does not contain a valid number, or one of the 0, 1, ..., n environment variables is not set, shift exits 100 with an error message.

•   shift calculates a shift value m, corresponding to argn arguments followed by enough arguments to make blockn blocks.

•   It shifts the positional parameters m times: the value of the m +1 variable becomes the value of the 1 variable, m +2 becomes 2 and so on, and # is set to n - m (floored at zero).

•   shift then exec(3) s into prog....

SEE ALSO
dollarat(1), elgetopt(1), exec(3)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/shift.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)