sbase

suckless unix tools
git clone git://git.suckless.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.
     25 The command is repeatedly executed one or more times until stdin is exhausted.
     26 .Pp
     27 Spaces, tabs and newlines may be embedded in arguments using single (`'')
     28 or double (`"') quotes or backslashes ('\\').
     29 Single quotes escape all non-single quote characters, excluding newlines, up
     30 to the matching single quote.
     31 Double quotes escape all non-double quote characters, excluding newlines, up
     32 to the matching double quote.
     33 Any single character, including newlines, may be escaped by a backslash.
     34 .Sh OPTIONS
     35 .Bl -tag -width Ds
     36 .It Fl n Ar num
     37 Use at most
     38 .Ar num
     39 arguments per command line.
     40 .It Fl r
     41 Do not run the command if there are no arguments.
     42 Normally the command is executed at least once even if there are no arguments.
     43 .It Fl E Ar eofstr
     44 Use
     45 .Ar eofstr
     46 as a logical EOF marker.
     47 .It Fl s Ar num
     48 Use at most
     49 .Ar num
     50 bytes per command line.
     51 .It Fl t
     52 Write the command line to stderr before executing it.
     53 .It Fl x
     54 Terminate if the command line exceeds the system limit or the number of bytes
     55 given with the
     56 .Op Fl s
     57 flag.
     58 .El
     59 .Sh EXIT STATUS
     60 .Nm
     61 exits with one of the following values:
     62 .Bl -tag -width Ds
     63 .It 0
     64 All invocations of
     65 .Ar cmd
     66 returned a zero exit status.
     67 .It 123
     68 One or more invocations of
     69 .Ar cmd
     70 returned a nonzero exit status.
     71 .It 124
     72 .Ar cmd
     73 exited with a 255 exit status.
     74 .It 125
     75 .Ar cmd
     76 was killed or stopped by a signal.
     77 .It 126
     78 .Ar cmd
     79 was found but could not be executed.
     80 .It 127
     81 .Ar cmd
     82 could not be found.
     83 .It 1
     84 Some other error occurred.
     85 .El
     86 .Sh STANDARDS
     87 The
     88 .Nm
     89 utility is compliant with the
     90 .St -p1003.1-2013
     91 specification except from the
     92 .Op Fl p
     93 flag.
     94 .Pp
     95 The
     96 .Op Fl r
     97 flag is an extension to that specification.