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 | -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
- -i : insist. If the data on stdin is invalid as
an environment variable, for instance if it contains a null
character, withstdinas exits 1.
- -D default : default value.
If the data on stdin is invalid, default is used as
variable's value. If neither the -i nor the -D
option have been given, withstdinas execs into
prog... with variable containing whatever value could be read on stdin,
cut before the first null character.
- -n : chomp an ending newline off stdin.
Notes
- You can start prog... with "import -u variable"
to perform variable substitution.