MULTISUBSTITUTE(1)

πŸ“¦ version 2.9.9.2, in nixpkgs unstable

πŸ’… MULTISUBSTITUTE(1) πŸ’…

okay so bestie, welcome to multisubstitute β€” the execline command that does several substitutions at once in its argv, and then executes another program. it's giving parallel processing realness, no cap. ✨


πŸŽ€ SYNOPSIS πŸŽ€

in an execlineb(1) script:

multisubstitute {
                [define [-N | -n] [-s] [-C | -c] [-d delim] variable
                value]
                [importas [-i | -D default] [-N | -n] [-s] [-C | -c]
                [-d delim] variable envvar]
                [importas -S [-i | -D default] [-N | -n] [-s] [-C | -c]
                [-d delim] envvar]
                [elglob [-v] [-w] [-s] [-m] [-e] [-0] variable pattern]
                [elgetpositionals [-P sharp]]
                [multidefine value { variable... }]
                ...
                }
                prog...

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, multisubstitute reads a block (cf. execline-block(7)) that's full of substitution commands. it then performs all those substitutions (cf. execline-substitute(7)) on prog... in parallel. like, at the same time. simultaneously. it's giving multitasking icon behavior. πŸ’–

check the relevant documentation page to learn the syntax of each substitution command β€” i'm not gonna hold your hand through every single one, bestie, you gotta read the lore yourself. πŸ“š

after all that, multisubstitute then exec(3)s into the modified prog.... so it fully replaces itself with the program. main character energy only. πŸ‘‘


✨ OPTIONS ✨

  • importas with -i β€” if this directive was given and the looked-up variable is undefined, multisubstitute will exit 100. periodt. like its direct program equivalent (cf. importas(1)), importas has two modes:
    • normal mode β€” takes a variable and an envvar as arguments and imports envvar under the name variable.
    • -S mode β€” only takes one argument and imports an environment variable under the same name. slay. πŸ’…

🌸 Rationale 🌸

πŸ”’ Security πŸ”’

multisubstitute can be used to avoid unwanted serial substitutions. consider the following script:

#!/command/execlineb
export A wrong
define B ${A}
importas A A
echo ${B}

running it will print wrong, because A is substituted after B. like, the order matters and it's giving chaos. πŸ™ˆ

on the contrary, the following script:

#!/command/execlineb
export A wrong
multisubstitute
{
  define B ${A}
  importas A A
}
echo ${B}

will print ${A}, because A and B are substituted at the same time. parallel. simultaneous. iconic. ✨

serial substitution may be what you want β€” but when in doubt, always perform parallel substitution. fr fr. no cap. πŸ’―

⚑ Efficiency ⚑

substitution (cf. execline-substitute(7)) is a costly mechanism: the whole argv is read three times and rewritten twice. serial substitution multiplies the cost by the number of substitutions, whereas parallel substitution pays the price only once. it's giving budget-friendly optimization. we love to see it. πŸŽ€


πŸ’œ Credits πŸ’œ

Paul Jarc[1] first originated the idea of the multisubstitute command and a possible syntax. we stan a pioneer. πŸ‘‘


🌈 SEE ALSO 🌈

define(1), elgetpositionals(1), elglob(1), execlineb(1), importas(1), multidefine(1), exec(3), execline-block(7), execline-substitute(7)

[1] https://code.dogmap.org/

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


🫢 AUTHORS 🫢

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


and that's the whole vibe, bestie! this page is from Debian, dated February 14, 2021 β€” happy valentine's day to all the execline girlies out there. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ˜­πŸ”₯πŸ‘‘πŸŒˆβ­πŸ’€πŸ™ˆπŸ“πŸ§šπŸ’œ

go forth and substitute in parallel. you got this. periodt. πŸ’…

πŸ“¦ where this page comes from