DASH is not Bash compatible, it's the other way around.
DASH shines in:
- Speed of execution. As simple, roughly 4x times faster than Bash and others.
- Very limited resources (disc space, RAM or CPU). As minimalistic - much smaller (134.1 kB vs 6.5 MB installed, 13 kSLOC vs 176 kSLOC) then Bash and others.
- Security. Long ago established tiny project, with simple and long ago established functionality. While it is well alive project with many developers. Which mean small attack surface, while many eyes on code.
- If classic
Use DASH as
Most POSIX compliant scripts specify
/bin/sh at the first line of the script, which means it will run
/bin/sh as the shell, which by default in Arch is a symlink to
You can re-symlink
/bin/dash, which can improve system performance, but first you must verify that none of the scripts that aren't explicitly
#!/bin/bash scripts are safely POSIX compliant and do not require any of Bash's features.
Features of bash that aren't included in Dash ('bashisms') will not work without being explicitly pointed to
/bin/bash. The following instructions will allow you to find any scripts that may need modification.
Install AUR.AUR from the
Common places to check
- Installed scripts with a
$ checkbashisms -f -p $(grep -IrlE '^#! ?(/usr)?/bin/(env )?sh' /usr/bin)
Once you have verified that it won't break any functionality, it should be safe to relink
/bin/sh. To do so use the following command:
# ln -sfT dash /usr/bin/sh
Updates of Bash will overwrite
/bin/sh with the default symlink. To prevent this, use the following pacman hook, which will relink
/bin/sh after every affected update:
[Trigger] Type = Package Operation = Install Operation = Upgrade Target = bash [Action] Description = Re-pointing /bin/sh symlink to dash... When = PostTransaction Exec = /usr/bin/ln -sfT dash /usr/bin/sh Depends = dash