execline: the forbacktickx command
Keywords: execline command forbacktickx

execline
Software
skarnet.org

# The `forbacktickx` program

`forbacktickx` runs a program and uses its output as loop elements to run another program.

## Interface

In an execlineb script:

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

- `forbacktickx` reads a block, 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 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.

## 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.
- `-0` : accept null characters from gen's output, using them as delimiters. If this option and a `-d` option are used simultaneously, the rightmost one wins.
- `-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 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.
- Other options are used to control the substitution mechanism for every x. Of course, you can't split x.

## Notes

- You can start loop... with "import -u variable" to perform variable substitution.
- forbacktickx is now implemented as a wrapper around the pipeline and forstdin commands, with calls to fdmove> to ensure that loop... is called with the proper standard input.