1SHIFT(1P) POSIX Programmer's Manual SHIFT(1P)
2
3
4
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
12 shift - shift positional parameters
13
15 shift [n]
16
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
27 be assumed to be 1. If n is 0, the positional and special parameters
28 are not changed.
29
31 None.
32
34 See the DESCRIPTION.
35
37 Not used.
38
40 None.
41
43 None.
44
46 Default.
47
49 Not used.
50
52 The standard error shall be used only for diagnostic messages.
53
55 None.
56
58 None.
59
61 The exit status is >0 if n>$#; otherwise, it is zero.
62
64 Default.
65
66 The following sections are informative.
67
69 None.
70
72 $ set a b c d e
73 $ shift 2
74 $ echo $*
75 c d e
76
78 None.
79
81 None.
82
84 Special Built-In Utilities
85
87 Portions of this text are reprinted and reproduced in electronic form
88 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
89 -- Portable Operating System Interface (POSIX), The Open Group Base
90 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
91 Electrical and Electronics Engineers, Inc and The Open Group. In the
92 event of any discrepancy between this version and the original IEEE and
93 The Open Group Standard, the original IEEE and The Open Group Standard
94 is the referee document. The original Standard can be obtained online
95 at http://www.opengroup.org/unix/online.html .
96
97
98
99IEEE/The Open Group 2003 SHIFT(1P)