1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. 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 8.1 (Berkeley) 6/6/93 37.\" 38.Dd June 6, 1993 39.Dt XARGS 1 40.Os 41.Sh NAME 42.Nm xargs 43.Nd "construct argument list(s) and execute utility" 44.Sh SYNOPSIS 45.Nm xargs 46.Op Fl 0 47.Op Fl t 48.Oo Op Fl x 49.Fl n Ar number 50.Oc 51.Op Fl s Ar size 52.Op Ar utility Op Ar arguments ... 53.Sh DESCRIPTION 54The 55.Nm 56utility reads space, tab, newline and end-of-file delimited arguments 57from the standard input and executes the specified 58.Ar utility 59with them as 60arguments. 61.Pp 62The utility and any arguments specified on the command line are given 63to the 64.Ar utility 65upon each invocation, followed by some number of the arguments read 66from standard input. 67The 68.Ar utility 69is repeatedly executed until standard input is exhausted. 70.Pp 71Spaces, tabs and newlines may be embedded in arguments using single 72(``\ '\ '') 73.Ek 74or double (``"'') quotes or backslashes (``\e''). 75Single quotes escape all non-single quote characters, excluding newlines, 76up to the matching single quote. 77Double quotes escape all non-double quote characters, excluding newlines, 78up to the matching double quote. 79Any single character, including newlines, may be escaped by a backslash. 80.Pp 81The options are as follows: 82.Bl -tag -width indent 83.It Fl 0 84Changes 85.Nm 86to expect NUL 87(``\\0'') 88characters as seperators, instead of spaces and newlines. 89This is expected to be used in concert with the 90.Fl print0 91function in 92.Nm find . 93.It Fl n Ar number 94Set the maximum number of arguments taken from standard input for each 95invocation of the utility. 96An invocation of 97.Ar utility 98will use less than 99.Ar number 100standard input arguments if the number of bytes accumulated (see the 101.Fl s 102option) exceeds the specified 103.Ar size 104or there are fewer than 105.Ar number 106arguments remaining for the last invocation of 107.Ar utility . 108The current default value for 109.Ar number 110is 5000. 111.It Fl s Ar size 112Set the maximum number of bytes for the command line length provided to 113.Ar utility . 114The sum of the length of the utility name and the arguments passed to 115.Ar utility 116(including 117.Dv NULL 118terminators) will be less than or equal to this number. 119The current default value for 120.Ar size 121is 122.Dv ARG_MAX 123- 2048. 124.It Fl t 125Echo the command to be executed to standard error immediately before it 126is executed. 127.It Fl x 128Force 129.Nm 130to terminate immediately if a command line containing 131.Ar number 132arguments will not fit in the specified (or default) command line length. 133.El 134.Pp 135If no 136.Ar utility 137is specified, 138.Xr echo 1 139is used. 140.Pp 141Undefined behavior may occur if 142.Ar utility 143reads from the standard input. 144.Pp 145The 146.Nm 147utility exits immediately (without processing any further input) if a 148command line cannot be assembled, 149.Ar utility 150cannot be invoked, an invocation of the utility is terminated by a signal 151or an invocation of the utility exits with a value of 255. 152.Pp 153The 154.Nm 155utility exits with a value of 0 if no error occurs. 156If 157.Ar utility 158cannot be invoked, 159.Nm 160exits with a value of 127. 161If any other error occurs, 162.Nm 163exits with a value of 1. 164.Sh SEE ALSO 165.Xr echo 1 , 166.Xr find 1 167.Sh STANDARDS 168The 169.Nm 170utility is expected to be 171.St -p1003.2 172compliant. 173