Imported upstream version 1.5
[manpages-zh.git] / raw / man1 / xargs.1
bloba9f39a731163d97cd035518530164715ffac258c
1 .TH XARGS 1L \" -*- nroff -*-
2 .SH NAME
3 xargs \- build and execute command lines from standard input
4 .SH SYNOPSIS
5 .B xargs
6 [\-0prtx] [\-e[eof-str]] [\-i[replace-str]] [\-l[max-lines]]
7 [\-n max-args] [\-s max-chars] [\-P max-procs] [\-\-null] [\-\-eof[=eof-str]]
8 [\-\-replace[=replace-str]] [\-\-max-lines[=max-lines]] [\-\-interactive]
9 [\-\-max-chars=max-chars] [\-\-verbose] [\-\-exit] [\-\-max-procs=max-procs]
10 [\-\-max-args=max-args] [\-\-no-run-if-empty] [\-\-version] [\-\-help]
11 [command [initial-arguments]]
12 .SH DESCRIPTION
13 This manual page
14 documents the GNU version of
15 .BR xargs .
16 .B xargs
17 reads arguments from the standard input, delimited by blanks (which can be
18 protected with double or single quotes or a backslash) or newlines,
19 and executes the
20 .I command
21 (default is /bin/echo) one or more times with any
22 .I initial-arguments
23 followed by arguments read from standard input.  Blank lines on the
24 standard input are ignored.
26 .B xargs
27 exits with the following status:
28 .nf
29 0 if it succeeds
30 123 if any invocation of the command exited with status 1-125
31 124 if the command exited with status 255
32 125 if the command is killed by a signal
33 126 if the command cannot be run
34 127 if the command is not found
35 1 if some other error occurred.
36 .fi
37 .SS OPTIONS
38 .TP
39 .I "\-\-null, \-0"
40 Input filenames are terminated by a null character instead of by
41 whitespace, and the quotes and backslash are not special (every
42 character is taken literally).  Disables the end of file string, which
43 is treated like any other argument.  Useful when arguments might
44 contain white space, quote marks, or backslashes.  The GNU find
45 \-print0 option produces input suitable for this mode.
46 .TP
47 .I "\-\-eof[=eof-str], \-e[eof-str]"
48 Set the end of file string to \fIeof-str\fR.  If the end of file
49 string occurs as a line of input, the rest of the input is ignored.
50 If \fIeof-str\fR is omitted, there is no end of file string.  If this
51 option is not given, the end of file string defaults to "_".
52 .TP
53 .I "\-\-help"
54 Print a summary of the options to
55 .B xargs
56 and exit.
57 .TP
58 .I "\-\-replace[=replace-str], \-i[replace-str]"
59 Replace occurences of \fIreplace-str\fR in the initial arguments with
60 names read from standard input.
61 Also, unquoted blanks do not terminate arguments.
62 If \fIreplace-str\fR is omitted, it
63 defaults to "{}" (like for `find \-exec').  Implies \fI\-x\fP and
64 \fI\-l 1\fP.
65 .TP
66 .I "\-\-max-lines[=max-lines], -l[max-lines]"
67 Use at most \fImax-lines\fR nonblank input lines per command line;
68 \fImax-lines\fR defaults to 1 if omitted.  Trailing blanks cause an
69 input line to be logically continued on the next input line.  Implies
70 \fI\-x\fR.
71 .TP
72 .I "\-\-max-args=max-args, \-n max-args"
73 Use at most \fImax-args\fR arguments per command line.  Fewer than
74 \fImax-args\fR arguments will be used if the size (see the \-s option)
75 is exceeded, unless the \-x option is given, in which case \fBxargs\fR
76 will exit.
77 .TP
78 .I "\-\-interactive, \-p"
79 Prompt the user about whether to run each command line and read a line
80 from the terminal.  Only run the command line if the response starts
81 with `y' or `Y'.  Implies \fI\-t\fR.
82 .TP
83 .I "\-\-no-run-if-empty, \-r"
84 If the standard input does not contain any nonblanks, do not run the
85 command.  Normally, the command is run once even if there is no input.
86 .TP
87 .I "\-\-max-chars=max-chars, \-s max-chars"
88 Use at most \fImax-chars\fR characters per command line, including the
89 command and initial arguments and the terminating nulls at the ends of
90 the argument strings.  The default is as large as possible, up to 20k
91 characters.
92 .TP
93 .I "\-\-verbose, \-t"
94 Print the command line on the standard error output before executing
95 it.
96 .TP
97 .I "\-\-version"
98 Print the version number of
99 .B xargs
100 and exit.
102 .I "\-\-exit, \-x"
103 Exit if the size (see the \fI\-s\fR option) is exceeded.
105 .I "\-\-max-procs=max-procs, \-P max-procs"
106 Run up to \fImax-procs\fR processes at a time; the default is 1.  If
107 \fImax-procs\fR is 0, \fBxargs\fR will run as many processes as
108 possible at a time.  Use the \fI\-n\fR option with \fI\-P\fR;
109 otherwise chances are that only one exec will be done.
110 .SH "SEE ALSO"
111 \fBfind\fP(1L), \fBlocate\fP(1L), \fBlocatedb\fP(5L), \fBupdatedb\fP(1)
112 \fBFinding Files\fP (on-line in Info, or printed)