FORBACKTICKX(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

✨ FORBACKTICKX(1) ✨

okay so bestie, you're looking at the forbacktickx page from the General Commands Manual and honestly? it's giving "run a program, steal its output, use that as your loop list" and it ATE. let me walk you through it 🫢


πŸŽ€ NAME πŸŽ€

forbacktickx β€” run a program and use its output as loop elements to run another program. that's it, that's the whole vibe. no cap. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

in an execlineb(1) script:

forbacktickx [-E | -e] [-p | -P maxpar | -o okcodes | -x breakcodes]
             [-N | -n] [-C | -c] [-0 | -d delim] variable { gen... }
             loop...

look at all those brackets bestie, it's like a little choose-your-own-adventure 😭 but don't worry, we're gonna go through every single one.


🌸 DESCRIPTION 🌸

so forbacktickx reads a block (cf. execline-block(7)), that's gen..., and it unquotes it. yes. unquotes. iconic behavior.

then it runs gen... as a child process. important note: gen's output must not contain a null character. like, that's a hard no. 🚫

it reads gen's output as it needs it, splitting it automatically (cf. execline-transform(7)). so you don't gotta do the splitting yourself, she handles it.

for every argument x in that split output, forbacktickx runs loop... as a child process, with variable= x added to its environment. πŸŽ€

and then forbacktickx exits 0. slay.

you can start loop... with importas -u variable variable if you wanna do variable substitution. also, plot twist: forbacktickx is now implemented as a wrapper around the pipeline(1) and forstdin(1) commands, with calls to fdmove(1) to make sure loop... gets called with the proper standard input. iykyk πŸ’œ


✨ OPTIONS ✨

  • -p β€” Parallel mode, bestie. do not wait for a loop... instance to finish before spawning the next one. she's multitasking. but don't worry, forbacktickx will still wait for all instances of loop to terminate before exiting, though. so she's not gonna ghost you. πŸ’€
  • -P maxpar β€” like -p, but with a maximum of maxpar parallel instances. this is the "please don't completely clog the machine in pathological cases" option and honestly bless whoever added it πŸ™ˆ
  • -o okcodes β€” okcodes must be a comma-separated list of exit codes. here's the tea: if the -p flag hasn't been given and loop exits with one of the codes in okcodes, forbacktickx will run the following instances of the loop. but if the exit code is not listed in okcodes, forbacktickx will exit immediately with an approximation (cf. execline-exitcodes(7)) of the same exit code. so like, she matches your energy, but only if you told her to. ✨
  • -x breakcodes β€” like the previous option, but with inverted meaning, periodt. the listed exit codes are codes that will make forbacktickx break the loop and exit, and the unlisted exit codes will make it keep looping. it's giving opposite day. πŸ’…
  • -e β€” No autoimport. this is the default. πŸŽ€
  • -E β€” Autoimport. instead of spawning loop..., spawn β€˜importas -ui variable variable loop...’. this substitutes variable into the command line instead of putting it into the environment. main character move honestly. πŸ‘‘

other options are similar (in name and functionality) to the switches passed to control a substitution mechanism[1] (cf. execline-transform(7)), and that's on purpose. however β€” and this is important bestie β€” forbacktickx does not call the substitution mechanism and has its own semantics for those options. so don't get it twisted. 😌

  • -N β€” store the whole line in variable, including the terminating newline (or other delimiter). keep the whole thing. no trimming. πŸ“
  • -n β€” chomp a terminating delimiter from the line from stdin before storing it into variable. this is the default. she's a little neater. βœ‚οΈ
  • -C β€” Crunch. if there's an empty line (i.e. one that only contains a delimiter), do not call loop. also, watch out: if this option is given, and chomping is active, and the last line of stdin is not terminated by a delimiter, then this last line will not be processed. so like, heads up ⚠️ that last line just gets dropped, fr fr.
  • -c β€” do not crunch, call loop even if the line is empty. this is the default. she's inclusive, she calls everyone. 🫢
  • -0 β€” accept null characters on its stdin, using them as delimiters. and if this option and a -d option are used simultaneously, the rightmost one wins. rightmost rights, that's the rule. πŸ†
  • -d delim β€” use the characters in string delim as delimiters for a line. default is β€˜\n’, meaning the input is only split on newlines. standard behavior, no notes. 🌈

🧚 SEE ALSO 🧚

execlineb(1), fdmove(1), forstdin(1), forx(1), loopwhilex(1), pipeline(1), execline-block(7), execline-exitcodes(7), execline-transform(7)

this man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/forbacktickx.html β€” go check it out if you want the original source of truth, bestie πŸ’–


πŸ‘‘ AUTHORS πŸ‘‘

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

and that's the whole page! πŸŽ‰ this version came from Debian, dated February 14, 2021 β€” a Valentine's Day gift to Unix nerds everywhere, and honestly? the most romantic thing a man page could do. mwah πŸ’‹ go write some loops, bestie. πŸ¦‹βœ¨

πŸ“¦ where this page comes from