1 | .\" Copyright (c) 1990 The Regents of the University of California.
|
---|
2 | .\" All rights reserved.
|
---|
3 | .\"
|
---|
4 | .\" This code is derived from software contributed to Berkeley by
|
---|
5 | .\" John B. Roll Jr. and the Institute of Electrical and Electronics
|
---|
6 | .\" Engineers, Inc.
|
---|
7 | .\"
|
---|
8 | .\" Redistribution and use in source and binary forms, with or without
|
---|
9 | .\" modification, are permitted provided that the following conditions
|
---|
10 | .\" are met:
|
---|
11 | .\" 1. Redistributions of source code must retain the above copyright
|
---|
12 | .\" notice, this list of conditions and the following disclaimer.
|
---|
13 | .\" 2. Redistributions in binary form must reproduce the above copyright
|
---|
14 | .\" notice, this list of conditions and the following disclaimer in the
|
---|
15 | .\" documentation and/or other materials provided with the distribution.
|
---|
16 | .\" 3. All advertising materials mentioning features or use of this software
|
---|
17 | .\" must display the following acknowledgement:
|
---|
18 | .\" This product includes software developed by the University of
|
---|
19 | .\" California, Berkeley and its contributors.
|
---|
20 | .\" 4. Neither the name of the University nor the names of its contributors
|
---|
21 | .\" may be used to endorse or promote products derived from this software
|
---|
22 | .\" without specific prior written permission.
|
---|
23 | .\"
|
---|
24 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
---|
25 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
---|
26 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
---|
27 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
---|
28 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
---|
29 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
---|
30 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
---|
31 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
---|
32 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
---|
33 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
34 | .\" SUCH DAMAGE.
|
---|
35 | .\"
|
---|
36 | .\" @(#)xargs.1 5.5 (Berkeley) 6/27/91
|
---|
37 | .\"
|
---|
38 | .TH XARGS 1 "June 27, 1991"
|
---|
39 | .UC 7
|
---|
40 | .SH NAME
|
---|
41 | xargs \- construct argument list(s) and execute utility.
|
---|
42 | .SH SYNOPSIS
|
---|
43 | .B xargs
|
---|
44 | .RB [ \-ft0 ]
|
---|
45 | .RB [[ \-x ]
|
---|
46 | .B \-n
|
---|
47 | .IR number ]
|
---|
48 | .RB [ \-s
|
---|
49 | .IR size ]
|
---|
50 | .RI [ utility
|
---|
51 | .RI [ argument " ...]]"
|
---|
52 | .SH DESCRIPTION
|
---|
53 | The
|
---|
54 | .B xargs
|
---|
55 | utility reads space, tab, newline and end-of-file delimited arguments
|
---|
56 | from the standard input and executes the specified
|
---|
57 | .I utility
|
---|
58 | with them as arguments.
|
---|
59 | .PP
|
---|
60 | The utility and any arguments specified on the command line are given
|
---|
61 | to the
|
---|
62 | .I utility
|
---|
63 | upon each invocation, followed by some number of the arguments read
|
---|
64 | from standard input.
|
---|
65 | The
|
---|
66 | .I utility
|
---|
67 | is repeatedly executed until standard input is exhausted.
|
---|
68 | .PP
|
---|
69 | Spaces, tabs and newlines may be embedded in arguments using single (`` ' '')
|
---|
70 | or double (``"'') quotes or backslashes (``\e'').
|
---|
71 | Single quotes escape all non-single quote characters, excluding newlines,
|
---|
72 | up to the matching single quote.
|
---|
73 | Double quotes escape all non-double quote characters, excluding newlines,
|
---|
74 | up to the matching double quote.
|
---|
75 | Any single character, including newlines, may be escaped by a backslash.
|
---|
76 | .PP
|
---|
77 | The options are as follows:
|
---|
78 | .TP
|
---|
79 | .B \-f
|
---|
80 | Force
|
---|
81 | .B xargs
|
---|
82 | to ignore the exit status returned by
|
---|
83 | .IR utility .
|
---|
84 | By default,
|
---|
85 | .B xargs
|
---|
86 | will exit immediately if
|
---|
87 | .I utility
|
---|
88 | exits with a non-zero exit status.
|
---|
89 | This does not include ignoring
|
---|
90 | .I utility
|
---|
91 | exiting due to a signal or without calling
|
---|
92 | .BR exit (2).
|
---|
93 | .TP
|
---|
94 | .BI \-n " number"
|
---|
95 | Set the maximum number of arguments taken from standard input for each
|
---|
96 | invocation of the utility.
|
---|
97 | An invocation of
|
---|
98 | .I utility
|
---|
99 | will use less than
|
---|
100 | .I number
|
---|
101 | standard input arguments if the number of bytes accumulated (see the
|
---|
102 | .I \-s
|
---|
103 | option) exceeds the specified
|
---|
104 | .I size
|
---|
105 | or there are fewer than
|
---|
106 | .I number
|
---|
107 | arguments remaining for the last invocation of
|
---|
108 | .IR utility .
|
---|
109 | The current default value for
|
---|
110 | .I number
|
---|
111 | is 5000.
|
---|
112 | .TP
|
---|
113 | .BI \-s " size"
|
---|
114 | Set the maximum number of bytes for the command line length provided to
|
---|
115 | .IR utility .
|
---|
116 | The sum of the length of the utility name and the arguments passed to
|
---|
117 | .I utility
|
---|
118 | (including NULL terminators) will be less than or equal to this number.
|
---|
119 | The current default value for
|
---|
120 | .I size
|
---|
121 | is ARG_MAX - 2048.
|
---|
122 | .TP
|
---|
123 | .B \-t
|
---|
124 | Echo the command to be executed to standard error immediately before it
|
---|
125 | is executed.
|
---|
126 | .TP
|
---|
127 | .B \-x
|
---|
128 | Force
|
---|
129 | .B xargs
|
---|
130 | to terminate immediately if a command line containing
|
---|
131 | .I number
|
---|
132 | arguments will not fit in the specified (or default) command line length.
|
---|
133 | .TP
|
---|
134 | .B \-0
|
---|
135 | Read null-byte terminated pathnames from standard input as may have been
|
---|
136 | produced by the
|
---|
137 | .B \-print0
|
---|
138 | option of
|
---|
139 | .BR find (1).
|
---|
140 | This is a MINIX 3 specific extension to
|
---|
141 | .BR xargs .
|
---|
142 | .PP
|
---|
143 | If no
|
---|
144 | .I utility
|
---|
145 | is specified,
|
---|
146 | .BR echo (1)
|
---|
147 | is used.
|
---|
148 | .PP
|
---|
149 | Undefined behavior may occur if
|
---|
150 | .I utility
|
---|
151 | reads from the standard input.
|
---|
152 | .PP
|
---|
153 | .B Xargs
|
---|
154 | exits with an exit status of 0 if no error occurs.
|
---|
155 | If
|
---|
156 | .I utility
|
---|
157 | cannot be invoked, is terminated by a signal or terminates without
|
---|
158 | calling
|
---|
159 | .BR exit (2),
|
---|
160 | .B xargs
|
---|
161 | exits with an exit status of 127.
|
---|
162 | If
|
---|
163 | .I utility
|
---|
164 | exits with an exit status other than 0,
|
---|
165 | .B xargs
|
---|
166 | exits with that exit status.
|
---|
167 | Otherwise,
|
---|
168 | .B xargs
|
---|
169 | exits with an exit status of 1.
|
---|
170 | .SH "SEE ALSO"
|
---|
171 | .BR echo (1),
|
---|
172 | .BR find (1).
|
---|
173 | .SH STANDARDS
|
---|
174 | The
|
---|
175 | .B xargs
|
---|
176 | utility is expected to be POSIX 1003.2 compliant.
|
---|