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.\" %sccs.include.redist.roff% 9.\" 10.\" @(#)xargs.1 8.1 (Berkeley) 06/06/93 11.\" 12.Dd 13.Dt XARGS 1 14.Os 15.Sh NAME 16.Nm xargs 17.Nd "construct argument list(s) and execute utility" 18.Sh SYNOPSIS 19.Nm xargs 20.Op Fl t 21.Oo Op Fl x 22.Fl n Ar number 23.Oc 24.Op Fl s Ar size 25.Op Ar utility Op Ar arguments ... 26.Sh DESCRIPTION 27The 28.Nm xargs 29utility reads space, tab, newline and end-of-file delimited arguments 30from the standard input and executes the specified 31.Ar utility 32with them as 33arguments. 34.Pp 35The utility and any arguments specified on the command line are given 36to the 37.Ar utility 38upon each invocation, followed by some number of the arguments read 39from standard input. 40The 41.Ar utility 42is repeatedly executed until standard input is exhausted. 43.Pp 44Spaces, tabs and newlines may be embedded in arguments using single 45(``\ '\ '') 46.Ek 47or double (``"'') quotes or backslashes (``\e''). 48Single quotes escape all non-single quote characters, excluding newlines, 49up to the matching single quote. 50Double quotes escape all non-double quote characters, excluding newlines, 51up to the matching double quote. 52Any single character, including newlines, may be escaped by a backslash. 53.Pp 54The options are as follows: 55.Bl -tag -width indent 56.It Fl n Ar number 57Set the maximum number of arguments taken from standard input for each 58invocation of the utility. 59An invocation of 60.Ar utility 61will use less than 62.Ar number 63standard input arguments if the number of bytes accumulated (see the 64.Fl s 65option) exceeds the specified 66.Ar size 67or there are fewer than 68.Ar number 69arguments remaining for the last invocation of 70.Ar utility . 71The current default value for 72.Ar number 73is 5000. 74.It Fl s Ar size 75Set the maximum number of bytes for the command line length provided to 76.Ar utility . 77The sum of the length of the utility name and the arguments passed to 78.Ar utility 79(including 80.Dv NULL 81terminators) will be less than or equal to this number. 82The current default value for 83.Ar size 84is 85.Dv ARG_MAX 86- 2048. 87.It Fl t 88Echo the command to be executed to standard error immediately before it 89is executed. 90.It Fl x 91Force 92.Nm xargs 93to terminate immediately if a command line containing 94.Ar number 95arguments will not fit in the specified (or default) command line length. 96.El 97.Pp 98If no 99.Ar utility 100is specified, 101.Xr echo 1 102is used. 103.Pp 104Undefined behavior may occur if 105.Ar utility 106reads from the standard input. 107.Pp 108The 109.Nm xargs 110utility exits immediately (without processing any further input) if a 111command line cannot be assembled, 112.Ar utility 113cannot be invoked, an invocation of the utility is terminated by a signal 114or an invocation of the utility exits with a value of 255. 115.Pp 116The 117.Nm xargs 118utility exits with a value of 0 if no error occurs. 119If 120.Ar utility 121cannot be invoked, 122.Nm xargs 123exits with a value of 127. 124If any other error occurs, 125.Nm xargs 126exits with a value of 1. 127.Sh SEE ALSO 128.Xr echo 1 , 129.Xr find 1 130.Sh STANDARDS 131The 132.Nm xargs 133utility is expected to be 134.St -p1003.2 135compliant. 136