execline
Software
skarnet.org
The forx program
forx runs a loop.
Interface
In an execlineb script:
forx [ -E | -e ] [ -p | -x breakcode ] variable { args... } loop...
- forx reads a
block and unquotes it.
That block contains a list of args.
- For each argument x in args...:
- forx performs
variable substitution
on loop..., with variable as key and x
as value. You cannot crunch, chomp or split x.
- It runs loop... as a child process.
- forx then exits 0.
Options
- -p : run in parallel. Do not wait for an instance of
loop... to exit before spawning the next one. forx
will still wait for all instances of loop to terminate before
exiting, though.
- -x breakcode : if the -p flag
hasn't been given and loop exits with the code breakcode,
do not run the following instances of the loop; exit immediately with the
same exit code.
- -E : forx performs the substitution for variable
itself. This is the current default, but it will change at some
point.
- -e : forx does not perform the substition for
variable; instead, it adds variable to loop's
environment, and loop should use the import
command to actually substitute variable. This will become the
default in the future.
Notes
- forx -E var { values... } loop... is exactly equivalent to
forx -e var { values... } import var unexport var loop....
It is actually implemented like this.