FORBACKTICKX(1)

NAME
forbacktickx - run a program and use its output as loop elements to run another program

SYNOPSIS
In an execlineb(1) script:

forbacktickx [-E | -e] [-p | -P maxpar | -o okcodes | -x breakcodes] [-N | -n] [-C | -c] [-0 | -d delim] variable { gen... } loop...

DESCRIPTION
forbacktickx reads a block ( cf. execline-block(7)), gen..., and unquotes it.

It runs gen... as a child process. gen' s output must not contain a null character.

It reads gen' s output as it needs, splitting ( cf. execline-transform(7)) it automatically.

For every argument x in the split output, forbacktickx runs loop... as a child process, with variable = x added to its environment.

forbacktickx then exits 0.

You can start loop... with ‘importas -u variable variable’ to perform variable substitution. forbacktickx is now implemented as a wrapper around the pipeline(1) and forstdin(1) commands, with calls to fdmove(1) to ensure that loop... is called with the proper standard input.

OPTIONS

-p  Parallel mode. Do not wait for a loop... instance to finish before spawning the next one. forbacktickx will still wait for all instances of loop to terminate before exiting, though.

-P maxpar
    Like -p, but with a maximum of maxpar parallel instances, to avoid completely clogging the machine in pathological cases.

-o okcodes
    okcodes must be a comma-separated list of exit codes. If the -p flag hasn't been given and loop exits with one of the codes in okcodes, forbacktickx will run the following instances of the loop, but if the exit code is not listed in okcodes, forbacktickx will exit immediately with an approximation ( cf. execline-exitcodes(7)) of the same exit code.

-x breakcodes
    Like the previous option, but with inverted meaning - the listed exit codes are codes that will make forbacktickx break the loop and exit, and the unlisted exit codes will make it keep looping.

-e  No autoimport. This is the default.

-E  Autoimport. Instead of spawning loop..., spawn ‘importas -ui variable variable loop...’. This substitutes variable into the command line instead of putting it into the environment.

Other options are similar (in name and functionality) to the switches passed to control a substitution mechanism[1] ( cf. execline-transform(7)), on purpose; however, forbacktickx does not call the substitution mechanism and has its own semantics for those options.

-N  Store the whole line in variable, including the terminating newline (or other delimiter).

-n  Chomp a terminating delimiter from the line from stdin before storing it into variable. This is the default.

-C  Crunch. If there is an empty line (i.e. that only contains a delimiter), do not call loop. If this option is given, and chomping is active, and the last line of stdin is not terminated by a delimiter, then this last line will not be processed.

-c  Do not crunch, call loop even if the line is empty. This is the default.

-0  Accept null characters on its stdin, using them as delimiters. If this option and a -d option are used simultaneously, the rightmost one wins.

-d delim
    Use the characters in string delim as delimiters for a line. Default is ‘\n’, meaning the input is only split on newlines.

SEE ALSO
execlineb(1), fdmove(1), forstdin(1), forx(1), loopwhilex(1), pipeline(1), execline-block(7), execline-exitcodes(7), execline-transform(7)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/forbacktickx.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)