16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

xargs<br />

Example<br />

If no command template appears on the command line, xargs uses echo by<br />

default. When xargs runs a command, it uses your search rules to find the<br />

command; this means that you can run shell scripts as well as normal programs.<br />

The command you want to execute should be in your search $PATH.<br />

xargs ends prematurely if it cannot run a constructed command or if an executed<br />

command returns a nonzero status.<br />

If an executed command is a shell program, it should explicitly contain an exit<br />

command to avoid returning a nonzero by accident; see sh for details.<br />

Other Options<br />

You can use the following options with any of the three main options.<br />

–E [eofstr]<br />

Defines eofstr to represent end-of-file on stdin. For example:<br />

–E :::<br />

tells xargs that ::: represents the end of stdin, even if an input file<br />

continues afterward. If there is no –E or –e option, a single underscore (_)<br />

marks the end of the input.<br />

In a doublebyte locale, eofstr may contain doublebyte characters.<br />

–e [eofstr]<br />

Acts like –E but the eofstr argument is optional. If you specify –e without<br />

eofstr, there is no end-of-file marker string, and _ is taken literally instead of<br />

as an end-of-file marker. xargs stops reading input when it reaches the<br />

specified end-of-file marker or the true end of the file.<br />

–p Prompts you before each command. This turns on the –t option so that you<br />

see each constructed command before it is run. Then xargs displays ?...,<br />

asking if you really want to run this command. If you type a string beginning<br />

with y, xargs runs the command as displayed; otherwise, the command is<br />

not run, and xargs constructs a new command.<br />

–s size<br />

Sets the maximum allowable size of an argument list to size characters<br />

(where size is an integer). The value of size must be less than or equal to<br />

the system variable LINE_MAX; if you omit the –s option, the default<br />

allowable size of an argument list is LINE_MAX. The length of the argument<br />

list is the length of the entire constructed command; this includes the length<br />

of the command name, the length of each argument, plus one blank for<br />

separating each item on the line.<br />

–t Writes each constructed command to stderr just before running the<br />

command.<br />

–x Kills xargs if it creates a command that is longer than the size given by the<br />

–s option (or {LINE_MAX} is –s was not specified). This option comes into<br />

effect automatically if you specify –i or –l.<br />

The following displays filenames in three columns:<br />

ls | xargs –n 3 echo<br />

818 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!