[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.11

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