Annotation of src/usr.bin/xargs/xargs.1, Revision 1.10
1.10 ! aaron 1: .\" $OpenBSD: xargs.1,v 1.9 2000/03/14 14:58:27 aaron Exp $
1.1 deraadt 2: .\" $NetBSD: xargs.1,v 1.6 1994/11/14 06:51:40 jtc Exp $
3: .\"
4: .\" Copyright (c) 1990, 1991, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" John B. Roll Jr. and the Institute of Electrical and Electronics
9: .\" Engineers, Inc.
10: .\"
11: .\" Redistribution and use in source and binary forms, with or without
12: .\" modification, are permitted provided that the following conditions
13: .\" are met:
14: .\" 1. Redistributions of source code must retain the above copyright
15: .\" notice, this list of conditions and the following disclaimer.
16: .\" 2. Redistributions in binary form must reproduce the above copyright
17: .\" notice, this list of conditions and the following disclaimer in the
18: .\" documentation and/or other materials provided with the distribution.
19: .\" 3. All advertising materials mentioning features or use of this software
20: .\" must display the following acknowledgement:
21: .\" This product includes software developed by the University of
22: .\" California, Berkeley and its contributors.
23: .\" 4. Neither the name of the University nor the names of its contributors
24: .\" may be used to endorse or promote products derived from this software
25: .\" without specific prior written permission.
26: .\"
27: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37: .\" SUCH DAMAGE.
38: .\"
39: .\" @(#)xargs.1 8.1 (Berkeley) 6/6/93
40: .\"
41: .Dd June 6, 1993
42: .Dt XARGS 1
43: .Os
44: .Sh NAME
45: .Nm xargs
46: .Nd "construct argument list(s) and execute utility"
47: .Sh SYNOPSIS
48: .Nm xargs
1.2 deraadt 49: .Op Fl 0
1.1 deraadt 50: .Op Fl t
51: .Oo Op Fl x
52: .Fl n Ar number
53: .Oc
54: .Op Fl s Ar size
55: .Op Ar utility Op Ar arguments ...
56: .Sh DESCRIPTION
57: The
1.7 aaron 58: .Nm
59: utility reads space, tab, newline, and end-of-file delimited arguments
1.1 deraadt 60: from the standard input and executes the specified
61: .Ar utility
62: with them as
63: arguments.
64: .Pp
65: The utility and any arguments specified on the command line are given
66: to the
67: .Ar utility
68: upon each invocation, followed by some number of the arguments read
69: from standard input.
70: The
71: .Ar utility
72: is repeatedly executed until standard input is exhausted.
73: .Pp
74: Spaces, tabs and newlines may be embedded in arguments using single
1.7 aaron 75: .Pq Ql '
76: or double
77: .Pq Ql \&"
78: quotes or backslashes
79: .Pq Ql \e .
1.1 deraadt 80: Single quotes escape all non-single quote characters, excluding newlines,
81: up to the matching single quote.
82: Double quotes escape all non-double quote characters, excluding newlines,
83: up to the matching double quote.
84: Any single character, including newlines, may be escaped by a backslash.
85: .Pp
86: The options are as follows:
1.10 ! aaron 87: .Bl -tag -width Ds
1.2 deraadt 88: .It Fl 0
89: Changes
1.7 aaron 90: .Nm
1.2 deraadt 91: to expect NUL
1.7 aaron 92: .Pq Ql \e0
1.5 deraadt 93: characters as separators, instead of spaces and newlines.
1.2 deraadt 94: This is expected to be used in concert with the
1.3 deraadt 95: .Fl print0
96: function in
1.7 aaron 97: .Xr find 1 .
1.1 deraadt 98: .It Fl n Ar number
99: Set the maximum number of arguments taken from standard input for each
100: invocation of the utility.
101: An invocation of
102: .Ar utility
103: will use less than
104: .Ar number
105: standard input arguments if the number of bytes accumulated (see the
106: .Fl s
107: option) exceeds the specified
108: .Ar size
109: or there are fewer than
110: .Ar number
111: arguments remaining for the last invocation of
112: .Ar utility .
113: The current default value for
114: .Ar number
115: is 5000.
116: .It Fl s Ar size
1.7 aaron 117: Set the maximum number of bytes for the command-line length provided to
1.1 deraadt 118: .Ar utility .
119: The sum of the length of the utility name and the arguments passed to
120: .Ar utility
1.7 aaron 121: (including null terminators) will be less than or equal to this number.
1.1 deraadt 122: The current default value for
123: .Ar size
124: is
125: .Dv ARG_MAX
1.8 deraadt 126: - 4096.
1.1 deraadt 127: .It Fl t
128: Echo the command to be executed to standard error immediately before it
129: is executed.
130: .It Fl x
131: Force
1.7 aaron 132: .Nm
1.1 deraadt 133: to terminate immediately if a command line containing
134: .Ar number
1.7 aaron 135: arguments will not fit in the specified (or default) command-line length.
1.1 deraadt 136: .El
137: .Pp
138: If no
139: .Ar utility
140: is specified,
141: .Xr echo 1
142: is used.
143: .Pp
144: Undefined behavior may occur if
145: .Ar utility
146: reads from the standard input.
147: .Pp
148: The
1.7 aaron 149: .Nm
1.1 deraadt 150: utility exits immediately (without processing any further input) if a
151: command line cannot be assembled,
152: .Ar utility
1.7 aaron 153: cannot be invoked, an invocation of the utility is terminated by a signal,
1.1 deraadt 154: or an invocation of the utility exits with a value of 255.
1.9 aaron 155: .Pp
1.7 aaron 156: .Nm
1.1 deraadt 157: exits with one of the following values:
1.6 aaron 158: .Pp
1.1 deraadt 159: .Bl -tag -width Ds -compact
160: .It 0
161: All invocations of
162: .Ar utility
163: returned a zero exit status.
164: .It 123
165: One or more invocations of
166: .Ar utility
167: returned a nonzero exit status.
168: .It 124
169: The
170: .Ar utility
171: exited with a 255 exit status.
172: .It 125
173: The
174: .Ar utility
175: was killed or stopped by a signal.
176: .It 126
177: The
178: .Ar utility
179: was found but could not be invoked.
180: .It 127
181: The
182: .Ar utility
183: could not be found.
184: .It 1
185: Some other error occurred.
186: .El
187: .Sh SEE ALSO
188: .Xr echo 1 ,
189: .Xr find 1
190: .Sh STANDARDS
191: The
1.7 aaron 192: .Nm
1.1 deraadt 193: utility is expected to be
194: .St -p1003.2
195: compliant.
196: .Sh HISTORY
1.7 aaron 197: The meaning of 123, 124, and 125 exit values were taken from GNU
198: .Nm xargs .