execline: a small scripting language
Keywords: execline script scripting language shell embedded chain loading bernstein chaining unix

Software
skarnet.org

# execline

## What is it?

execline is a (non-interactive) scripting language, like `sh` - but its syntax is quite different from a traditional shell syntax. The `execlineb` program is meant to be used as an interpreter for a text file; the other commands are essentially useful inside an `execlineb` script.

execline is as powerful as a shell: it features conditional loops, getopt-style option handling, filename globbing, and more. Meanwhile, its syntax is far more logical and predictable than the shell's syntax, and has no security issues.

- The execline design and grammar
- Why not just use `/bin/sh`?

## Installation

### Requirements

- A POSIX-compliant system with a standard C development environment
- GNU make, version 3.81 or later.
- skalibs version 2.15.0.0 or later. It's a build-time requirement. It's also a run-time requirement if you link against the shared version of the skalibs library.

The following optional dependencies are also supported:

- If you're using musl and want nsswitch-like functionality: nsss version 0.2.1.2 or later (build-time and boot-time)

### Licensing

execline is free software. It is available under the ISC license.

### Download

- The current released version of execline is 2.9.9.0. You can access its checksum here.
- Alternatively, you can checkout a copy of the execline git repository:

       git clone git://git.skarnet.org/execline

- There's also a Codeberg mirror, or a GitHub mirror, or a SourceHut mirror of the execline git repository.

### Compilation

- See the enclosed INSTALL file for installation details.
- Starting with 2.9.2.0, there's an `--enable-multicall` configure option to save disk space.

### Upgrade notes

- This page lists the differences to be aware of between the previous versions of execline and the current one.

## Reference

### Commands

All these commands exit 111 if they encounter a temporary error, and 100 if they encounter a permanent error - such as a misuse. They exit 127 if they're trying to execute into a program and cannot find it, and 126 if they fail to execute into a program for another reason.

(Script parser / launcher)

- The `execlineb` program

(Process state control)

- The `execline-cd` program
- The `posix-cd` program
- The `execline-umask` program
- The `posix-umask` program
- The `emptyenv` program
- The `envfile` program
- The `export` program
- The `export-array` program
- The `unexport` program
- The `fdclose` program
- The `fdblock` program
- The `fdmove` program
- The `fdswap` program
- The `fdreserve` program
- The `redirfd` program
- The `piperw` program
- The `heredoc` program
- The `wait` program
- The `getcwd` program
- The `getpid` program
- The `exec` program
- The `tryexec` program
- The `exit` program
- The `trap` program
- The `withstdinas` program

(Basic block management)

- The `foreground` program
- The `background` program
- The `case` program
- The `if` program
- The `ifelse` program
- The `ifte` program
- The `ifthenelse` program
- The `backtick` program
- The `pipeline` program
- The `runblock` program

(Variable management)

- The `define` program
- The `importas` program
- The `elglob` program
- The `elgetpositionals` program
- The `multidefine` program
- The `multisubstitute` program

(Loops)

- The `forx` program
- The `forstdin` program
- The `forbacktickx` program
- The `loopwhilex` program

(Positional parameters and options management)

- The `elgetopt` program
- The `shift` program
- The `dollarat` program

(Miscellaneous)

- The `eltest` program
- The `homeof` program

(Multicall configuration)

- The `execline` multicall binary

### Provided scripts: example `.profile` replacement

- The `execline-shell` script
- The `execline-startup` script

### Fun stuff

- An execline quine. This was quinely provided by Joël Riou. The only external command used is `echo`.
- Another quine, provided by Paul Jarc. It is much shorter, but uses the external commands `echo` and `env`. Later, Paul rewrote it using only `echo`, then using only `echo` and the environment.
- Another quine, provided by David Madore. It uses the external command `printf`. It is longer, but quite stylish.
- Another quine, provided by Sertonix. This one only uses commands from the execline package, and no external commands!

## Related resources

### execline manual pages

- Lennart Jablonka is providing the execline documentation as a set of man pages.

### execline discussion

- `execline` is discussed on the skaware mailing-list.