sbase

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

xargs.1 (2332B)


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