shift

NAME

shift - shifts parameter/argument list values

SYNOPSIS

C shell

shift [variable]

Korn shell

shift [number]

DESCRIPTION

This command is a built-in command in the C shell and the Korn shell.

C shell

Without arguments, shift(1) discards argv[1] and shifts the members of argv to the left. It is an error for argv not to be set or to have less than one word as value. With variable, shift(1) performs the same function on variable.

Korn shell

The shift(1) command shifts positional parameters. Positional parameter 1 will be assigned the value of parameter 1+number, parameter 2 will be assigned the value of parameter 2+number, and so on. The parameters represented by the numbers $# down to $#-number+1 will be unset, and the parameter "#" will be updated to reflect the new number of positional parameters. The value number must be an unsigned decimal integer less than or equal to the value of the special parameter "#". If number is not given, it is assumed to be 1. If number is 0, the positional and special parameters will not be changed.