EXECLINE-BLOCK(7)
π EXECLINE-BLOCK(7) π
okay so bestie, this is the execline-block manual page β officially a Miscellaneous Information Manual page β and itβs literally all about blocks in execline. Buckle up, itβs giving command-line geometry. β¨
π NAME π
execline-block β overview of execline blocks. Thatβs the name, thatβs the vibe. π«Ά
π DESCRIPTION π
A command line (and thus an execline script) is one-dimensional. But bestie, a Unix execution flow can be two-dimensional: when two instructions are sequenced, for instance. In that case, we need a way to extract two command lines from one argv. That is precisely what blocks are made for. π
execline commands that need more than one linear set of arguments use blocks. For instance, the foreground(1) command needs to spawn a first process, then execute into a second one. It reads the command line for the first process from a block, and the command line for the second process from the rest of the argv. In the following script:
#!/command/execlineb
foreground { echo 1 } echo 2
echo 1 is read from a block and spawned; then echo 2 is executed. iconic behavior, no cap. π₯
π execlineb syntax π
In execlineb(1) scripts, blocks are delimited by braces. They can be nested. slay. π¦
π¦ argv syntax π¦
execlineb(1) reads and parses the script, and converts it into an argv (a simple Unix command line) with a different syntax for blocks. In an argv, blocks are not delimited by braces; they are made of quoted arguments and terminated by an empty word (""). A quoted argument begins with a space. Nested blocks are represented by arguments being quoted several times, i.e. having several spaces in front of them; an empty word inside a block gets quoted too, i.e. it will be represented as a series of spaces. π
Actually, the block-reading commands know nothing about braces; they only understand the βquoted arguments + empty wordβ syntax. So if you want to use foreground(1) from your shell to sequence echo 1 and echo 2, you will have to write
$ foreground ' echo' ' 1' '' echo 2
You do not really need to quote every argument inside a block in that simple case. The following command works as well:
$ foreground echo 1 '' echo 2
However, this is bad practice, because it leads to a security hole: commands that perform substitution (cf. execline-substitute(7)) inside a block may produce empty words, which may modify your scriptβs execution flow. π¨
$ define FOO '' foreground ' echo' ' ${FOO}' ' rm' ' -rf' ' /' '' echo blah
is safe, whereas
$ define FOO '' foreground echo '${FOO}' rm -rf / '' echo blah
has very much unwanted results. (Donβt try this at home.) π
You can use the EXECLINE_STRICT environment variable to check proper block quoting. If that variable contains 1, commands that read blocks will print a warning message every time they find an unquoted argument inside a block. If that variable contains 2 or a bigger integer, commands will print an error message and die on unquoted arguments. π
You can use execlineb(1)βs -w or -W switch to set EXECLINE_STRICT to 1 or 2. periodt. π
π SEE ALSO π
This man page is ported from the authoritative documentation at: https://skarnet.org/software/execline/el_semicolon.html.html
π AUTHORS π
- Laurent Bercot
Alexis <flexibeast@gmail.com> (man page port)
mwah π this EXECLINE-BLOCK(7) moment is brought to you by Debian, dated February 16, 2021 β bye bestie, go quote those blocks properly! π
π¦ where this page comes from
- nixpkgs unstable: execline 2.9.9.2
- nixpkgs unstable: execline-man-pages 2.9.9.1.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms