Built-in commands compared¶
This page lists every built-in command of dash, bash, zsh and luish, and for those luish lacks, what to use instead. It complements luish, dash, bash and zsh; Built-in commands documents luish’s own built-ins in full.
The lists are those of dash 0.5.12 (Debian and Ubuntu’s), bash 5.2 (compgen -b), zsh 5.9 (${(k)builtins}
with no startup files, which includes the built-ins of modules zsh loads on demand, such as zstyle and the
completion system’s) and luish 0.7.0. zsh’s other modules, loaded with zmodload (such as zsh/files, zsh/datetime
or zsh/system), add more, and bash can load more with enable -f; those are not listed.
dash |
bash |
zsh |
luish |
|
|---|---|---|---|---|
Built-ins |
38 |
61 |
103 |
54, and 8 more in interactive shells |
In the tables, ✓ marks a built-in, – its absence, and i a built-in that luish has only in interactive shells (and
their subshells), so that scripts find the same commands as under dash; there, __luish_internal NAME runs it.
POSIX special built-ins¶
All four shells have these. As POSIX requires, an error in a special built-in exits a non-interactive shell, and assignments before one stay set; luish follows dash in both.
Built-in |
dash |
bash |
zsh |
luish |
luish compared with bash and zsh |
|---|---|---|---|---|---|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
Further arguments are the positional parameters while the file runs, as in bash and zsh |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
No |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
Takes arrays ( |
|
✓ |
✓ |
✓ |
✓ |
Takes arrays; no |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
POSIX’s options, with |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
Signals and |
|
✓ |
✓ |
✓ |
✓ |
|
POSIX regular built-ins and utilities¶
The commands that POSIX requires to be built in (alias, bg, cd, command, fc, fg, getopts, hash,
jobs, kill, read, type, ulimit, umask, unalias, wait), and the utilities that shells build in for
speed.
Built-in |
dash |
bash |
zsh |
luish |
luish compared with bash and zsh |
|---|---|---|---|---|---|
|
✓ |
✓ |
✓ |
✓ |
POSIX’s operators, as dash; |
|
✓ |
✓ |
✓ |
✓ |
zsh’s options ( |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
As dash’s: escapes such as |
|
✓ |
✓ |
✓ |
✓ |
|
|
– [1] |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
No options (bash’s |
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
|
|
✓ |
✓ |
✓ |
✓ |
Jobs and process ids; no |
Common extensions¶
Built-ins outside POSIX that luish has, mostly as zsh has them.
Built-in |
dash |
bash |
zsh |
luish |
Notes |
|---|---|---|---|---|---|
|
– |
– |
✓ |
i |
zsh’s, for the emacs keymap and the widgets luish has; keys can also be named ( |
|
– |
✓ |
✓ |
✓ |
|
|
– |
✓ |
– |
✓ |
bash’s |
|
✓ |
– |
✓ |
✓ |
The same as |
|
– |
✓ |
✓ |
✓ |
|
|
– |
✓ |
✓ |
✓ |
As in zsh, with bash’s |
|
– |
✓ |
✓ |
✓ |
As in zsh: |
|
– |
✓ |
– |
i |
Help for luish’s built-ins, from the pages in Built-in commands |
|
– |
✓ |
✓ |
✓ |
As in zsh; integers only |
|
✓ |
✓ |
✓ |
✓ |
Special, as in dash. Takes |
|
– |
– |
✓ |
i |
zsh’s, with its options except |
|
– |
– |
✓ |
✓ |
zsh’s names for the options luish has, and luish’s grouped names ( |
|
– |
✓ |
– |
✓ |
bash’s, setting luish’s options that do the same ( |
|
– |
✓ |
✓ |
✓ |
As in zsh: a name without |
|
– |
– |
✓ |
i |
zsh’s, without its widget options ( |
Built-ins that luish lacks¶
In both bash and zsh¶
Built-in |
What it does |
In luish |
|---|---|---|
|
Turn built-ins off or on |
|
|
List the history |
|
|
Exit a login shell |
|
|
Stop the shell |
|
bash only¶
Built-in |
What it does |
In luish |
|---|---|---|
|
readline key bindings |
|
|
Programmable completion |
Completers in Rhai, from plugins; |
|
Read lines into an array |
A loop: |
zsh only¶
Built-in |
What it does |
In luish |
|---|---|---|
|
Run a command as a login shell would ( |
None |
|
Define a function to be loaded from |
None: |
|
Exit |
|
|
The completion system (compsys) |
Completers in Rhai, from plugins |
|
The old completion system |
As above |
|
Terminal capabilities |
|
|
Emulate sh, ksh or csh |
None: luish is always an |
|
Floating-point and integer variables |
|
|
List or define functions |
|
|
The buffer stack |
None |
|
csh-style resource limits |
|
|
Report logins and logouts ( |
None |
|
Run a command without globbing |
|
|
Variables not seen by called functions |
|
|
Re-run a command |
|
|
Clear the command cache |
Rarely needed (automatic); |
|
Run commands at a given time |
None |
|
Freeze the terminal’s settings |
None |
|
Remove functions, aliases or cached commands |
|
|
Describe or find commands |
|
|
Compile scripts |
None needed for startup files: the startup cache saves their effect |
|
Formatting and parsing helpers |
|
|
Line editor widgets |
|
|
Load modules |
Plugins, with extensions in Rhai that can add commands |
|
Style settings, mostly for completion |
Settings in |
luish’s own¶
Built-in |
What it does |
|---|---|
|
Subcommands that are not needed often: |
|
Put text on the clipboard, through the terminal |
|
Load, list, add, fetch and update plugins |
|
Set or show the styles and colour schemes of the line editor |
|
Show where variables were set, with |
Plugins can add further built-ins, written in Rhai (see Extensions).
Reserved words¶
Some commands that look like built-ins are reserved words, parsed with the command.
Word |
dash |
bash |
zsh |
luish |
Notes |
|---|---|---|---|---|---|
|
✓ |
✓ |
✓ |
✓ |
POSIX |
|
– |
✓ |
✓ |
✓ |
|
|
– |
✓ |
✓ |
✓ |
|
|
– |
✓ |
✓ |
– |
Runs the |
|
– |
✓ |
✓ |
– |
|
|
– |
✓ |
✓ |
– |
|
|
– |
– |
✓ |
– |
|
|
– |
– |
✓ |
– |
In zsh, these are reserved words so that |