Dash#
The Debian Almquist Shell. Dash is the default /bin/sh on
Debian-family distributions and is built for script execution
speed, not interactive use. Stock dash links against the kernel
read() syscall directly and does not include a line
editor: no readline, no history, no completion, no Ctrl-r. What
the operator sees at an interactive dash prompt is whatever the
terminal driver provides.
For a comfortable interactive shell, use bash, zsh, or fish. Reach for dash when measuring script-start overhead, validating POSIX-only behaviour, or running on an embedded target where size matters.
Terminal Driver#
The terminal driver (stty) provides the only line editing
dash sees. These are POSIX special characters, set per-terminal
and overridable with stty <name> <key>. stty -a prints
every current setting.
Key |
Action |
|---|---|
|
erase the previous character on the current line |
|
erase the whole line (terminal-driver erase, not a shell widget) |
|
erase the previous word (whitespace-delimited) |
|
send SIGINT to the foreground process |
|
send SIGQUIT to the foreground process (core dump) |
|
send SIGTSTP (suspend) to the foreground process |
|
send EOF; on an empty line, exits the shell |
|
pause terminal output (XOFF) |
|
resume terminal output (XON) |
|
reprint the current line (terminal driver, not history) |
|
take the next character literally (escape control characters) |
What Does NOT Work#
Reflexes from bash / zsh that produce no result in interactive dash.
Key |
Result in dash |
|---|---|
|
prints raw escape sequence ( |
|
prints raw escape sequence; cursor does not move |
|
inserts a literal tab character |
|
reprints the line (terminal driver), no history search |
|
inserted as raw control characters |
|
inserted as |
|
no history expansion (POSIX history is opt-in; dash has none) |
Workarounds#
To make dash usable interactively, wrap it in a line-editor front-end.
Command |
Action |
|---|---|
|
readline-style editing and per-program history |
|
persistent history file |
|
filename completion on Tab |
|
similar wrapper via socat |
|
lightweight line-editor wrapper (less common) |
|
print every terminal-driver setting |
|
set Backspace to send Ctrl-H |
|
set the word-erase character |
|
reset all settings to defaults after a stuck terminal |
References#
man 1 dash,man 1p sh(POSIX shell).man 1 stty,man 7 termios(the terminal driver underneath every shell).Dash for
/bin/shusage details.