FreeBSD Manual Pages
XE(1) FreeBSD General Commands Manual XE(1) NAME xe -- run command for each line or argument SYNOPSIS xe [-0FRnv] [-I arg] [-N maxargs] [-j maxjobs] command ... xe [flags ...] -f argfile command ... xe [flags ...] -s shellscript xe [flags ...] -a command ... -- args ... xe [flags ...] -A argsep command ... argsep args ... DESCRIPTION xe is a new tool for constructing command lines from file listings or arguments, which includes the best features of xargs(1) and apply(1). xe means ``execute for every ...''. xe supports different ways to get arguments: command ... By default, arguments are read from standard input separated by newlines. The command is constructed by taking the command line parameters, replacing arg with the read argument and then using execvp(3) to run the command. In this mode, no shell is involved and arg must appears as its own word. If no argument is passed, default is `printf %s\n'. -f argfile Like previous, but read arguments from argfile instead of stan- dard input. This will not close standard input for execution. -s shellscript In this mode, the single argument shellscript is executed using sh -c. In the script, the passed arguments can be accessed using $1, $2, ... -a command ... -- args ... In this mode, all arguments after -- are passed as arguments to the command. -A argsep command ... argsep args ... Same as previous, but a custom argument separator argsep is used to distinguish between command and arguments. The options are as follows: -0 Input filenames are separated by NUL bytes (instead of newlines, which is the default) -F Fatal: stop and exit when a command execution failed. -R Return with status 122 when no arguments have been passed (instead of 0, the default). xe never executes a command when no arguments are passed. -n Dry run: don't run the commands, just print them. -v Verbose: print commands to standard error before running them. -I arg Replace occurrences of arg (default: {}) in the command with the argument(s). Pass an empty arg to disable the replace function. Contrary to xargs(1) this also works when multiple arguments are to be inserted. -N maxargs Pass up to maxargs arguments to each command (default: 1). Using -N0 will pass as many arguments as possible. -j maxjobs Run up to maxjobs processes concurrently. Using -j0 will run as many processes as there are CPU cores running. ENVIRONMENT The environment variable ITER is passed to the child process and incre- mented on every command execution. EXIT STATUS xe uses the convention of GNU and OpenBSD xargs: 0 on success 123 if any invocation of the command exited with status 1 to 125. 124 if the command exited with status 255 125 if the command was killed by a signal 126 if the command cannot be run 127 if the command was not found 1 if some other error occurred Additionally, 122 is returned when -R was passed and the command never was executed. SEE ALSO apply(1), parallel(1), xapply(1), xargs(1) AUTHORS Leah Neukirchen <leah@vuxu.org> LICENSE xe is in the public domain. To the extent possible under law, the creator of this work has waived all copyright and related or neighboring rights to this work. http://creativecommons.org/publicdomain/zero/1.0/ FreeBSD 11.1 November 30, 2016 FreeBSD 11.1
NAME | SYNOPSIS | DESCRIPTION | ENVIRONMENT | EXIT STATUS | SEE ALSO | AUTHORS | LICENSE
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=xe&manpath=FreeBSD+11.1-RELEASE+and+Ports>