2015-10-08 11:15:08 -04:00
|
|
|
.Dd 2015-10-08
|
2015-01-31 08:20:02 -05:00
|
|
|
.Dt XARGS 1
|
2015-01-31 14:37:03 -05:00
|
|
|
.Os sbase
|
2015-01-30 15:51:23 -05:00
|
|
|
.Sh NAME
|
|
|
|
.Nm xargs
|
2015-03-22 17:53:12 -04:00
|
|
|
.Nd construct argument lists and execute command
|
2015-01-30 15:51:23 -05:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2015-03-22 17:53:12 -04:00
|
|
|
.Op Fl rtx
|
2015-01-30 15:51:23 -05:00
|
|
|
.Op Fl E Ar eofstr
|
2015-03-22 17:53:12 -04:00
|
|
|
.Op Fl n Ar num
|
|
|
|
.Op Fl s Ar num
|
|
|
|
.Op Ar cmd Op Ar arg ...
|
2015-01-30 15:51:23 -05:00
|
|
|
.Sh DESCRIPTION
|
2015-02-01 14:52:28 -05:00
|
|
|
.Nm
|
|
|
|
reads space, tab, newline and EOF delimited strings from stdin
|
|
|
|
and executes the specified
|
|
|
|
.Ar cmd
|
|
|
|
with the strings as
|
|
|
|
.Ar arguments .
|
2015-01-30 15:51:23 -05:00
|
|
|
.Pp
|
2014-01-03 06:52:47 -05:00
|
|
|
Any arguments specified on the command line are given to the command upon
|
|
|
|
each invocation, followed by some number of the arguments read from
|
2020-03-01 17:37:31 -05:00
|
|
|
stdin.
|
|
|
|
The command is repeatedly executed one or more times until stdin is exhausted.
|
2015-01-30 15:51:23 -05:00
|
|
|
.Pp
|
2014-01-03 06:52:47 -05:00
|
|
|
Spaces, tabs and newlines may be embedded in arguments using single (`'')
|
2020-03-01 17:37:31 -05:00
|
|
|
or double (`"') quotes or backslashes ('\\').
|
|
|
|
Single quotes escape all non-single quote characters, excluding newlines, up
|
|
|
|
to the matching single quote.
|
|
|
|
Double quotes escape all non-double quote characters, excluding newlines, up
|
|
|
|
to the matching double quote.
|
|
|
|
Any single character, including newlines, may be escaped by a backslash.
|
2015-01-30 15:51:23 -05:00
|
|
|
.Sh OPTIONS
|
|
|
|
.Bl -tag -width Ds
|
2015-03-22 17:53:12 -04:00
|
|
|
.It Fl n Ar num
|
2015-02-01 14:52:28 -05:00
|
|
|
Use at most
|
2015-03-22 17:53:12 -04:00
|
|
|
.Ar num
|
2015-02-01 14:52:28 -05:00
|
|
|
arguments per command line.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It Fl r
|
2020-03-01 17:37:31 -05:00
|
|
|
Do not run the command if there are no arguments.
|
|
|
|
Normally the command is executed at least once even if there are no arguments.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It Fl E Ar eofstr
|
2015-02-01 14:52:28 -05:00
|
|
|
Use
|
|
|
|
.Ar eofstr
|
|
|
|
as a logical EOF marker.
|
2015-03-22 17:53:12 -04:00
|
|
|
.It Fl s Ar num
|
|
|
|
Use at most
|
|
|
|
.Ar num
|
|
|
|
bytes per command line.
|
|
|
|
.It Fl t
|
|
|
|
Write the command line to stderr before executing it.
|
|
|
|
.It Fl x
|
|
|
|
Terminate if the command line exceeds the system limit or the number of bytes
|
|
|
|
given with the
|
|
|
|
.Op Fl s
|
|
|
|
flag.
|
2015-01-30 15:51:23 -05:00
|
|
|
.El
|
|
|
|
.Sh EXIT STATUS
|
2015-03-22 17:53:12 -04:00
|
|
|
.Nm
|
|
|
|
exits with one of the following values:
|
2015-01-30 15:51:23 -05:00
|
|
|
.Bl -tag -width Ds
|
|
|
|
.It 0
|
2015-03-22 17:53:12 -04:00
|
|
|
All invocations of
|
|
|
|
.Ar cmd
|
|
|
|
returned a zero exit status.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 123
|
2015-03-22 17:53:12 -04:00
|
|
|
One or more invocations of
|
|
|
|
.Ar cmd
|
|
|
|
returned a nonzero exit status.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 124
|
2015-03-22 17:53:12 -04:00
|
|
|
.Ar cmd
|
|
|
|
exited with a 255 exit status.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 125
|
2015-03-22 17:53:12 -04:00
|
|
|
.Ar cmd
|
|
|
|
was killed or stopped by a signal.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 126
|
2015-03-22 17:53:12 -04:00
|
|
|
.Ar cmd
|
|
|
|
was found but could not be executed.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 127
|
2015-03-22 17:53:12 -04:00
|
|
|
.Ar cmd
|
|
|
|
could not be found.
|
2015-01-30 15:51:23 -05:00
|
|
|
.It 1
|
|
|
|
Some other error occurred.
|
|
|
|
.El
|
2015-03-22 17:53:12 -04:00
|
|
|
.Sh STANDARDS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
utility is compliant with the
|
2015-03-27 12:22:48 -04:00
|
|
|
.St -p1003.1-2013
|
|
|
|
specification except from the
|
2015-03-22 17:53:12 -04:00
|
|
|
.Op Fl p
|
|
|
|
flag.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Op Fl r
|
|
|
|
flag is an extension to that specification.
|