BACKTICK(1)

NAME
backtick - run a program and stores its output in an environment variable, then execute another program

SYNOPSIS
In an execlineb(1) script:
backtick [-i | -I | -x | -D default] [-N | -n] [[-E | -e] variable { prog1... } prog2...

DESCRIPTION
backtick reads prog1... in an execline-block(7) 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 exec(3) s into prog2..., with variable added to the environment with prog1...' s output as a value.

OPTIONS

-N  Store prog1...' s output as is, including the last newline, if any.

-n  Chomp an ending newline off prog1...' s output. This is the default.

-e  No autoimport. This is the default.

-E  Autoimport. Before exec(3)' ing into prog2..., perform a substitution ( cf. execline-substitute(7)) so that ‘$?’ is replaced with prog1...' s exitcode ( if applicable, see below), and ‘${ variable }’ is replaced with prog1...' s output, instead of keeping the results in the environment. The variables will not appear in the environment; if they preexisted in backtick' s environment, they will be removed.

-i  backtick exits with an approximation ( cf. execline-exitcodes(7)) of prog1' s exit code, or 124 if prog1 wrote a null character. This is the default.

-I  The value of variable is set to whatever the start of prog1...' s output is, up to the first null character, or to whatever prog1... wrote before crashing; chomping is applied if required; then execution proceeds.

-x  variable is removed from the environment, and execution proceeds.

-D default
    The value of variable is set to default, and execution proceeds.

SEE ALSO
background(1), foreground(1), if(1), ifelse(1), ifte(1), ifthenelse(1), pipeline(1), runblock(1), execline-block(7)

This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/backtick.html

AUTHORS
Laurent Bercot Alexis <flexibeast@gmail.com> (man page port)