shift

shift KornShell positional parameters 

KornShell Built-in


SYNOPSIS

shift [expression]


DESCRIPTION

shift renames the KornShell positional parameters so that i+nth positional parameter becomes the ith positional parameter, where n is the value of the given arithmetic expression. If you omit expression, the default value is 1. The value of expression must be between zero and the number of positional parameters ($#), inclusive. The value of $# is updated.


EXAMPLE

The commands:

set a b c d
shift 2
echo $*

produce:

c d

DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

1 

Failure because the expression had a negative value or was greater than the number of positional parameters.

bad shift count expr 

You specified an expression that did not evaluate to a number in the range from 0 to the number of remaining positional parameters.


PORTABILITY

POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 2000. Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.

Allowing an expression, rather than just a number, is an extension found in the KornShell.


NOTE

This is a special built-in command of the MKS KornShell and should not be confused with the shift command internal to cmd.exe.


AVAILABILITY

MKS Toolkit for Power Users
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
MKS Integrity


SEE ALSO

Commands:
set, sh


MKS Toolkit 9.5 Documentation Build 3.