execline
Software
www.skarnet.org

The execlineb program

execlineb reads and executes a script.

Interface

     execlineb [ -q | -w | -W ] [ -p | -P ] -c script [ args... ]
or
     execlineb [ -q | -w | -W ] [ -p | -P ] scriptfile [ args... ]
or in an executable file:
#!/command/execlineb [ -qwWpP ]
script

Options

See below for the other options.

Syntax of scripts

An execlineb script is a string that must not contain the null character. execlineb parses it and divides it into words. The parser recognizes the following components:

You can see an example of distinct execlineb components here.

In addition to that "natural" parsing, that the execline command performs as well, execlineb includes the following specific support:

Here is an example: this execlineb script makes heavy use of blocks. execlineb parses it into a command line that looks closely like this script.

For proper execution, the sequence of words must follow the execline grammar.

Options for block syntax checking

External execline commands that read blocks, like foreground, use the EXECLINE_STRICT environment variable: if it is set to 1, they will print a warning message on stderr if they find their blocks not to be properly quoted. If it is set to 2, they will also die. If it is set to 0, or unset, they won't complain at all.

Normally the EXECLINE_STRICT environment variable is unset (or inherited from the caller if the -P option is given). You can force it unset, set to 1, or set to 2 by giving respectively the -q, -w or -W option to execlineb.

Options for environment management

Normally, execline scripts are reentrant: environment variables potentially overwritten by execlineb, such as #, 0 or EXECLINE_STRICT, are pushed. This is the standard, safe behaviour. Nevertheless, it is rather costly, and may be unneeded for small scripts: for those cases, execline-1.05 comes with two options that bypass the environment management. Be warned that the sole purpose of these options is optimization, and you should not use them if you're not familiar with the way execlineb uses the environment to store positional parameters.

Please note that if you use the -p option, the EXECLINE_STRICT variable will be inherited from the caller: don't forget to set -q explicitly if needed. If you use the -P option, your script may also inherit meaningless #, 0, and such variables from the caller.

Current limitations

execlineb builds and executes a unique argv with the script: hence scripts are subject to OS-dependent limitations such as the kernel buffer size for argv and envp - at least 64 kB on most systems. This means that execlineb cannot execute arbitrarily large scripts. Be careful with deeply nested scripts too: without the -p option, each execlineb invocation uses up some space in the environment.