[BACK]Return to xargs.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / xargs

Annotation of src/usr.bin/xargs/xargs.1, Revision 1.4

1.4     ! deraadt     1: .\"    $OpenBSD: xargs.1,v 1.6 1994/11/14 06:51:40 jtc 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
                     58: .Nm xargs
                     59: utility reads space, tab, newline and end-of-file delimited arguments
                     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
                     75: (``\ '\ '')
                     76: .Ek
                     77: or double (``"'') quotes or backslashes (``\e'').
                     78: Single quotes escape all non-single quote characters, excluding newlines,
                     79: up to the matching single quote.
                     80: Double quotes escape all non-double quote characters, excluding newlines,
                     81: up to the matching double quote.
                     82: Any single character, including newlines, may be escaped by a backslash.
                     83: .Pp
                     84: The options are as follows:
                     85: .Bl -tag -width indent
1.2       deraadt    86: .It Fl 0
                     87: Changes
                     88: .Nm xargs
                     89: to expect NUL
                     90: (``\\0'')
                     91: characters as seperators, instead of spaces and newlines.
                     92: This is expected to be used in concert with the
1.3       deraadt    93: .Fl print0
                     94: function in
1.2       deraadt    95: .Nm find .
1.1       deraadt    96: .It Fl n Ar number
                     97: Set the maximum number of arguments taken from standard input for each
                     98: invocation of the utility.
                     99: An invocation of
                    100: .Ar utility
                    101: will use less than
                    102: .Ar number
                    103: standard input arguments if the number of bytes accumulated (see the
                    104: .Fl s
                    105: option) exceeds the specified
                    106: .Ar size
                    107: or there are fewer than
                    108: .Ar number
                    109: arguments remaining for the last invocation of
                    110: .Ar utility .
                    111: The current default value for
                    112: .Ar number
                    113: is 5000.
                    114: .It Fl s Ar size
                    115: Set the maximum number of bytes for the command line length provided to
                    116: .Ar utility .
                    117: The sum of the length of the utility name and the arguments passed to
                    118: .Ar utility
                    119: (including
                    120: .Dv NULL
                    121: terminators) will be less than or equal to this number.
                    122: The current default value for
                    123: .Ar size
                    124: is
                    125: .Dv ARG_MAX
                    126: - 2048.
                    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
                    132: .Nm xargs
                    133: to terminate immediately if a command line containing
                    134: .Ar number
                    135: arguments will not fit in the specified (or default) command line length.
                    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
                    149: .Nm xargs
                    150: utility exits immediately (without processing any further input) if a
                    151: command line cannot be assembled,
                    152: .Ar utility
                    153: cannot be invoked, an invocation of the utility is terminated by a signal
                    154: or an invocation of the utility exits with a value of 255.
                    155: .Sh DIAGNOSTICS
                    156: .Nm xargs
                    157: exits with one of the following values:
                    158: .Bl -tag -width Ds -compact
                    159: .It 0
                    160: All invocations of
                    161: .Ar utility
                    162: returned a zero exit status.
                    163: .It 123
                    164: One or more invocations of
                    165: .Ar utility
                    166: returned a nonzero exit status.
                    167: .It 124
                    168: The
                    169: .Ar utility
                    170: exited with a 255 exit status.
                    171: .It 125
                    172: The
                    173: .Ar utility
                    174: was killed or stopped by a signal.
                    175: .It 126
                    176: The
                    177: .Ar utility
                    178: was found but could not be invoked.
                    179: .It 127
                    180: The
                    181: .Ar utility
                    182: could not be found.
                    183: .It 1
                    184: Some other error occurred.
                    185: .El
                    186: .Sh SEE ALSO
                    187: .Xr echo 1 ,
                    188: .Xr find 1
                    189: .Sh STANDARDS
                    190: The
                    191: .Nm xargs
                    192: utility is expected to be
                    193: .St -p1003.2
                    194: compliant.
                    195: .Sh HISTORY
                    196: The meaning of 123, 124, and 125 exit values were taken from GNU xargs.