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

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       shift — shift positional parameters
13

SYNOPSIS

15       shift [n]
16

DESCRIPTION

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

OPTIONS

31       None.
32

OPERANDS

34       See the DESCRIPTION.
35

STDIN

37       Not used.
38

INPUT FILES

40       None.
41

ENVIRONMENT VARIABLES

43       None.
44

ASYNCHRONOUS EVENTS

46       Default.
47

STDOUT

49       Not used.
50

STDERR

52       The standard error shall be used only for diagnostic messages.
53

OUTPUT FILES

55       None.
56

EXTENDED DESCRIPTION

58       None.
59

EXIT STATUS

61       If the n operand is invalid or is greater than "$#", this may  be  con‐
62       sidered  a  syntax  error  and a non-interactive shell may exit; if the
63       shell does not exit in this case,  a  non-zero  exit  status  shall  be
64       returned. Otherwise, zero shall be returned.
65

CONSEQUENCES OF ERRORS

67       Default.
68
69       The following sections are informative.
70

APPLICATION USAGE

72       None.
73

EXAMPLES

75       $ set a b c d e
76       $ shift 2
77       $ echo $*
78       c d e
79

RATIONALE

81       None.
82

FUTURE DIRECTIONS

84       None.
85

SEE ALSO

87       Section 2.14, Special Built-In Utilities
88
90       Portions  of  this text are reprinted and reproduced in electronic form
91       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
92       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
93       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
94       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
95       event of any discrepancy between this version and the original IEEE and
96       The  Open Group Standard, the original IEEE and The Open Group Standard
97       is the referee document. The original Standard can be  obtained  online
98       at http://www.opengroup.org/unix/online.html .
99
100       Any  typographical  or  formatting  errors that appear in this page are
101       most likely to have been introduced during the conversion of the source
102       files  to  man page format. To report such errors, see https://www.ker
103       nel.org/doc/man-pages/reporting_bugs.html .
104
105
106
107IEEE/The Open Group                  2017                            SHIFT(1P)
Impressum