1SHIFT(P)                   POSIX Programmer's Manual                  SHIFT(P)
2
3
4

NAME

6       shift - shift positional parameters
7

SYNOPSIS

9       shift [n]
10

DESCRIPTION

12       The  positional  parameters  shall  be  shifted. Positional parameter 1
13       shall be assigned the value of parameter (1+n), parameter  2  shall  be
14       assigned the value of parameter (2+n), and so on. The parameters repre‐
15       sented by the numbers "$#" down to "$#-n+1" shall  be  unset,  and  the
16       parameter '#' is updated to reflect the new number of positional param‐
17       eters.
18
19       The value n shall be an unsigned decimal integer less than or equal  to
20       the  value  of the special parameter '#' .  If n is not given, it shall
21       be assumed to be 1. If n is 0, the positional  and  special  parameters
22       are not changed.
23

OPTIONS

25       None.
26

OPERANDS

28       See the DESCRIPTION.
29

STDIN

31       Not used.
32

INPUT FILES

34       None.
35

ENVIRONMENT VARIABLES

37       None.
38

ASYNCHRONOUS EVENTS

40       Default.
41

STDOUT

43       Not used.
44

STDERR

46       The standard error shall be used only for diagnostic messages.
47

OUTPUT FILES

49       None.
50

EXTENDED DESCRIPTION

52       None.
53

EXIT STATUS

55       The exit status is >0 if n>$#; otherwise, it is zero.
56

CONSEQUENCES OF ERRORS

58       Default.
59
60       The following sections are informative.
61

APPLICATION USAGE

63       None.
64

EXAMPLES

66              $ set a b c d e
67              $ shift 2
68              $ echo $*
69              c d e
70

RATIONALE

72       None.
73

FUTURE DIRECTIONS

75       None.
76

SEE ALSO

78       Special Built-In Utilities
79
81       Portions  of  this text are reprinted and reproduced in electronic form
82       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
83       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
84       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
85       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
86       event of any discrepancy between this version and the original IEEE and
87       The  Open Group Standard, the original IEEE and The Open Group Standard
88       is the referee document. The original Standard can be  obtained  online
89       at http://www.opengroup.org/unix/online.html .
90
91
92
93IEEE/The Open Group                  2003                             SHIFT(P)
Impressum