execline
Software
skarnet.org
The backtick program
backtick runs a program and uses its output as the argument of
another program.
Interface
In an execlineb script:
backtick [ -i ] [ -n ] variable { prog1... } prog2...
- backtick reads prog1... in a
block and unquotes it.
- It runs prog1... as a child process and saves its
output in memory. This output must not contain a null character.
- backtick execs into the modified prog2..., with
variable added to the environment with prog1...'s
output as a value.
Options
- -i : insist. If prog1 exits non-zero,
backtick exits with the same exit code (or 111 if prog1
crashed for some reason). Without this option, backtick execs into
prog2... no matter what prog1 does, with the null word as
variable's value if prog1 didn't write anything before
dying.
- -n : chomp an ending newline off prog1...'s
output.
Notes
- You can start prog2... with "import variable unexport variable"
to perform variable substitution.