BACKTICK(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

Okay bestie, you’ve opened BACKTICK(1) from the General Commands Manual, and it’s giving β€œgrab a program’s output, stash it in an environment variable, then run another program” energy. πŸ’…βœ¨

🌸 NAME 🌸

backtick β€” runs a program, stores its output in an environment variable, then executes 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. 🫢

Then it runs prog1... as a child process and saves its output in memory. 🧠✨

🚨 Warning, bestie: this output must not contain a null character. Like, hard no. 🚫

Then backtick exec(3)s into prog2..., with variable added to the environment with prog1...’s output as a value. Slay. πŸ‘‘

πŸ’… OPTIONS πŸ’…

  • -N β€” Store prog1...’s output as is, including the last newline, if any. No trimming, no games. πŸŽ€
  • -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 🌈

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)

xoxo, Debian πŸ’– April 16, 2024 πŸ’– BACKTICK(1) πŸŽ€

πŸ“¦ where this page comes from