dash(1)
dash is a POSIX-compliant shell designed for speed and minimal size, commonly used as /bin/sh on modern Linux systems.
Synopsis
dash [OPTIONS] [FILE] [ARGUMENTS]Description
dash is a lightweight shell implementation that prioritizes POSIX compliance and execution speed over feature richness. It is often used as the system shell (/bin/sh) for shell scripts and system initialization, replacing the heavier bash in many distributions. dash executes shell scripts and interactive commands with minimal overhead.
Unlike bash, dash omits many extensions and features, making it faster for script execution and reducing system resource usage. It supports the core POSIX shell syntax and builtins, making it ideal for portable scripts that should work across different Unix-like systems.
Common options
| Flag | What it does |
|---|---|
-c STRING | Execute the command string and exit |
-e | Exit immediately if a command exits with non-zero status |
-f | Disable pathname expansion (globbing) |
-i | Force interactive mode with prompts |
-n | Read commands but do not execute them (syntax check) |
-s | Read commands from standard input |
-u | Treat undefined variables as an error |
-x | Print each command and its arguments before execution (debug mode) |
-v | Print shell input lines as they are read |
Examples
Execute a shell script using dash as the interpreter
dash script.shRun a single command string and exit
dash -c 'echo "Hello World"'Check syntax of a script without executing it
dash -n script.shExecute a loop with debug output showing each command
dash -x -c 'for i in 1 2 3; do echo $i; done'Read and execute commands from stdin
echo 'echo test' | dashRun script with immediate exit on any error
dash -e script.shStart an interactive dash shell session
dash -iTreat undefined variable references as errors
dash -u -c 'echo $UNDEFINED_VAR'