Open System Services Shell and Utilities Reference Manual (G06.28+, H06.05+)
User Commands (s) shift(1)
NAME
shift - Shifts positional parameters
SYNOPSIS
shift [n]
DESCRIPTION
The shift command moves the specified positional parameter so that it takes the place of the
specified parameter to its left. Thus, the positional parameters from $n+1 ... are renamed $n ... .
The parameters represented by the numbers $# down to $#-n+1 are unset, and the parameter # is
updated to reflect the new number of positional parameters. The argument n can be any arith-
metic expression that evaluates to a nonnegative number less than or equal to $#.
EXIT VALUES
The exit status is greater than 0 (zero) if n is greater than $#; otherwise, it is 0 (zero).
NOTES
• Parameter assignment lists that precede the command remain in effect when the com-
mand completes.
• I/O redirections are processed after parameter assignments.
• Errors cause a script that contains the commands so marked to abort.
The shift command is a shell built-in command. It differs from the regular commands in that it
does not open a new shell process when it executes.
A general discussion of shell built-in commands and a list of the OSS shell built-in commands
are in the reference page for sh(1).
RELATED INFORMATION
Commands: sh(1).
527188-007 Hewlett-Packard Company 8−43