sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

xargs.1 (2158B)


      1 .Dd 2015-10-08
      2 .Dt XARGS 1
      3 .Os sbase
      4 .Sh NAME
      5 .Nm xargs
      6 .Nd construct argument lists and execute command
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Op Fl rtx
     10 .Op Fl E Ar eofstr
     11 .Op Fl n Ar num
     12 .Op Fl s Ar num
     13 .Op Ar cmd Op Ar arg ...
     14 .Sh DESCRIPTION
     15 .Nm
     16 reads space, tab, newline and EOF delimited strings from stdin
     17 and executes the specified
     18 .Ar cmd
     19 with the strings as
     20 .Ar arguments .
     21 .Pp
     22 Any arguments specified on the command line are given to the command upon
     23 each invocation, followed by some number of the arguments read from
     24 stdin. The command is repeatedly executed one or more times until stdin
     25 is exhausted.
     26 .Pp
     27 Spaces, tabs and newlines may be embedded in arguments using single (`'')
     28 or double (`"') quotes or backslashes ('\\'). Single quotes escape all
     29 non-single quote characters, excluding newlines, up to the matching single
     30 quote. Double quotes escape all non-double quote characters, excluding
     31 newlines, up to the matching double quote. Any single character, including
     32 newlines, may be escaped by a backslash.
     33 .Sh OPTIONS
     34 .Bl -tag -width Ds
     35 .It Fl n Ar num
     36 Use at most
     37 .Ar num
     38 arguments per command line.
     39 .It Fl r
     40 Do not run the command if there are no arguments. Normally the command is
     41 executed at least once even if there are no arguments.
     42 .It Fl E Ar eofstr
     43 Use
     44 .Ar eofstr
     45 as a logical EOF marker.
     46 .It Fl s Ar num
     47 Use at most
     48 .Ar num
     49 bytes per command line.
     50 .It Fl t
     51 Write the command line to stderr before executing it.
     52 .It Fl x
     53 Terminate if the command line exceeds the system limit or the number of bytes
     54 given with the
     55 .Op Fl s
     56 flag.
     57 .El
     58 .Sh EXIT STATUS
     59 .Nm
     60 exits with one of the following values:
     61 .Bl -tag -width Ds
     62 .It 0
     63 All invocations of
     64 .Ar cmd
     65 returned a zero exit status.
     66 .It 123
     67 One or more invocations of
     68 .Ar cmd
     69 returned a nonzero exit status.
     70 .It 124
     71 .Ar cmd
     72 exited with a 255 exit status.
     73 .It 125
     74 .Ar cmd
     75 was killed or stopped by a signal.
     76 .It 126
     77 .Ar cmd
     78 was found but could not be executed.
     79 .It 127
     80 .Ar cmd
     81 could not be found.
     82 .It 1
     83 Some other error occurred.
     84 .El
     85 .Sh STANDARDS
     86 The
     87 .Nm
     88 utility is compliant with the
     89 .St -p1003.1-2013
     90 specification except from the
     91 .Op Fl p
     92 flag.
     93 .Pp
     94 The
     95 .Op Fl r
     96 flag is an extension to that specification.