1shift(1)                         User Commands                        shift(1)
2
3
4

NAME

6       shift  -  shell built-in function to traverse either a shell's argument
7       list or a list of field-separated words
8

SYNOPSIS

10   sh
11       shift [n]
12
13
14   csh
15       shift [variable]
16
17
18   ksh
19       *shift [n]
20
21
22   ksh
23       +shift [n]
24
25

DESCRIPTION

27   sh
28       The positional parameters from $n+1 ... are renamed $1 ... .  If  n  is
29       not specified, it is assumed to be 1.
30
31   csh
32       The  components  of  argv, or variable, if supplied, are shifted to the
33       left, discarding the first component. It is an error for  the  variable
34       not to be set or to have a null value.
35
36   ksh
37       The  positional  parameters  from  $n+1  $n+1  ...  are renamed $1 ...,
38       default n is 1. The parameter n can be any arithmetic  expression  that
39       evaluates to a non-negative number less than or equal to $#.
40
41
42       On  this manual page, ksh(1) commands that are preceded by one or two *
43       (asterisks) are treated specially in the following ways:
44
45           1.     Variable assignment lists preceding the  command  remain  in
46                  effect when the command completes.
47
48           2.     I/O redirections are processed after variable assignments.
49
50           3.     Errors cause a script that contains them to abort.
51
52           4.     Words,  following  a  command preceded by ** that are in the
53                  format of a variable assignment, are expanded with the  same
54                  rules  as  a variable assignment. This means that tilde sub‐
55                  stitution is performed after the = sign and  word  splitting
56                  and file name generation are not performed.
57
58   ksh93
59       shift is a shell special built-in that shifts the positional parameters
60       to the left by the number of places defined by n, or 1 if n is omitted.
61       The  number of positional parameters remaining is reduced by the number
62       of places that are shifted.
63
64
65       If n is specified, it is  evaluated  as  an  arithmetic  expression  to
66       determine  the  number of places to shift. It is an error to shift more
67       than the number of  positional  parameters  or  a  negative  number  of
68       places.
69
70
71       The following exit values are returned by shift in ksh93:
72
73       0     Successful  completion.  The  positional parameters were success‐
74             fully shifted.
75
76
77       >0    An error occurred.
78
79
80
81       On this manual page, ksh93(1) commands that are preceded by one or  two
82       + are treated specially in the following ways:
83
84           1.     Variable  assignment  lists  preceding the command remain in
85                  effect when the command completes.
86
87           2.     I/O redirections are processed after variable assignments.
88
89           3.     Errors cause a script that contains them to abort.
90
91           4.     They are not valid function names.
92
93           5.     Words, following a command preceded by ++ that  are  in  the
94                  format  of a variable assignment, are expanded with the same
95                  rules as a variable assignment. This means that  tilde  sub‐
96                  stitution  is performed after the = sign and field splitting
97                  and file name generation are not performed.
98

ATTRIBUTES

100       See attributes(5) for descriptions of the following attributes:
101
102
103
104
105       ┌─────────────────────────────┬─────────────────────────────┐
106       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
107       ├─────────────────────────────┼─────────────────────────────┤
108       │Availability                 │SUNWcsu                      │
109       └─────────────────────────────┴─────────────────────────────┘
110

SEE ALSO

112       csh(1), ksh(1), ksh93(1), sh(1), attributes(5)
113
114
115
116SunOS 5.11                        20 Nov 2007                         shift(1)
Impressum