execline
Software
skarnet.org
The withstdinas program
withstdinas reads the entirety of its standard input in an
environment variable, and runs another program with that additional
environment variable.
Interface
In an execlineb script:
withstdinas [ -i | -I | -D default ] [ -n ] variable prog...
- withstdinas reads its stdin until EOF.
- It then execs into prog..., with
variable added to the environment; the value of
variable is what was read on stdin.
Options
- -n : chomp an ending newline off stdin.
The other options tell withstdinas what to do if its input is
not suitable as the contents of an environment variable, i.e. it
contains a null character:
- -i : withstdinas exits 1.
- -I : variable is removed from
the environment, and execution proceeds.
- -D default : the value of variable
is set to default, and execution proceeds.
- neither of those options: the value of variable is set to whatever the
start of the input is, up to the first null character; and execution proceeds.
Notes
- You can start prog... with "importas -u variable variable"
to perform variable substitution.