Almquist shell#dash: Ubuntu, Debian and POSIX compliance of Linux distributions

{{Short description|Lightweight Unix shell}}

{{Infobox software

| name = Almquist shell

| logo =

| screenshot =

| caption =

| developer = Kenneth Almquist

| released = {{Start date and age|1989|05|30}}

| latest release version =

| latest release date =

| programming language = C

| operating system = Unix-like

| platform = Cross-platform

| genre = Unix shell

| license =

| website =

}}

Almquist shell (also known as A Shell, ash and sh) is a lightweight Unix shell originally written by Kenneth Almquist in the late 1980s. Initially a clone of the System V.4 variant of the Bourne shell, it replaced the original Bourne shell in the BSD versions of Unix released in the early 1990s.

History

ash was first released via a posting to the {{mono|comp.sources.unix}} Usenet news group, approved and moderated by Rich Salz on 30 May 1989. It was described as "a reimplementation of the System V shell [with] most features of that shell, plus some additions".{{Cite web| title=v19i001: A reimplementation of the System V shell, Part01/08 | url=https://groups.google.com/d/topic/comp.sources.unix/A6cnyKX-Gq4/discussion | date=May 30, 1989 | editor=Rich Salz | editor-link=Rich Salz | author=Almquist, Kenneth | publisher=Usenet newsgroup, comp.sources.unix}}

Fast, small, and virtually compatible{{citation needed|date=February 2016}} with the POSIX standard's specification of the Unix shell, ash did not provide line editing or command history mechanisms, because Almquist felt that such functionality should be moved into the terminal driver. However, modern variants support it.

The following is extracted from the ash package information from Slackware v14:

{{Blockquote|

ash (Kenneth Almquist's ash shell)

A lightweight (92K) Bourne compatible shell. Great for machines with low memory, but does not provide all the extras of shells like bash, tcsh, and zsh. Runs most shell scripts compatible with the Bourne shell. Note that under Linux, most scripts seem to use at least some bash-specific syntax. The Slackware setup scripts are a notable exception, since ash is the shell used on the install disks. NetBSD uses ash as its /bin/sh.

}}

Myriad forks have been produced from the original ash release.{{cite web |last1=Mascheck |first1=Sven |title=Ash (Almquist Shell) Variants

|url=https://www.in-ulm.de/~mascheck/various/ash/ |website=www.in-ulm.de}} These derivatives of ash are installed as the default shell (/bin/sh) on FreeBSD, NetBSD, DragonFly BSD, MINIX, and in some Linux distributions. MINIX 3.2 used the original ash version, whose test feature differed from POSIX.{{cite web |url=https://invisible-island.net/autoconf/portability-test.html |title=TEST versus Portability |author=Thomas E. Dickey |year=2015 |access-date=March 1, 2020}} That version of the shell was replaced in MINIX 3.3. Android used ash until Android 4.0, at which point it switched to mksh.{{cite web

| url=https://android.googlesource.com/platform/system/core/+/master/shell_and_utilities/README.md

| title=Android's shell and utilities

| author=Elliott Hughes

| date=2018-06-20

| access-date=2020-02-29}}

{{anchor|dash}}Dash

{{Infobox software

| name = Debian Almquist shell (DASH)

| logo =

| screenshot =

| caption =

| developer = Herbert Xu

| released = {{Start date and age|1997|07|15}}

| latest release version = 0.5.12

| latest release date ={{Start date and age|2022|12|11}}

| programming language = C

| operating system = Linux, Android

| platform =

| genre = Unix shell

| license = 3-clause BSD license with mksignames under GNU GPL{{cite web |last1=Xu |first1=Herbert |title=COPYING |url=https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/COPYING?h=v0.5.12 |website=The Linux Kernel Archives |access-date=23 December 2023}}

| website = {{URL|gondor.apana.org.au/~herbert/dash/}}

| repo = {{URL|git.kernel.org/pub/scm/utils/dash/dash.git}}

}}

In 1997 Herbert Xu ported ash from NetBSD to Debian Linux. In September 2002, with release 0.4.1, this port was renamed to Dash (Debian Almquist shell). Xu's main priorities are POSIX conformance and slim implementation.

Like its predecessor, Dash implements support for neither internationalization and localization nor multi-byte character encoding (both required in POSIX).{{Citation needed|date=March 2023}} Line editing and history support based on GNU Readline is optional ({{code|--with-libedit}}).

= Adoption in Debian and Ubuntu =

{{anchor|Slimness}}Because of its slimness, Ubuntu decided to adopt Dash as the default /bin/sh{{cite web

| url=https://wiki.debian.org/Shell

| title=Non-interactive Shell

| website=Debian Wiki

| date=2020-01-13

| access-date=2020-02-29}}{{cite web

| url=https://wiki.ubuntu.com/DashAsBinSh

| title=Dash as /bin/sh

| website=Ubuntu Wiki

| date=2017-12-16

| access-date=2020-02-29}} in October 2006 with version 6.10. The reason for using Dash is faster shell script execution,{{cite book

| author=Neal Krawetz

| title=Ubuntu: Powerful Hacks and Customizations

| year=2011

| publisher=John Wiley & Sons

| pages=178

| url=https://books.google.com/books?id=h_zclqESvu8C&pg=PT178

| isbn=9781118080382}} especially during startup of the operating system, compared to previous versions of Debian and Ubuntu that used Bash for this purpose, although Bash is still the default login shell for interactive use.{{cite book

| author1=Christopher Negus

| author2=Francois Caen

| title=Ubuntu Linux Toolbox

| publisher=John Wiley & Sons

| year=2011

| url=https://books.google.com/books?id=L_IXUtw_w-AC&pg=PA49

| pages=49

| isbn=9781118079140}}

A result of the shift is that many shell scripts were found making use of Bash-specific functionalities ("bashisms") without properly declaring it in the shebang line.{{cite web

| url=https://bugs.launchpad.net/ubuntu/+source/dash/+bug/61463

| title=Script that are using bash could be broken with the new symlink

| author=Egil Hasting

| date=2006-09-20

| publisher=Launchpad

| access-date=2020-02-29}}{{cite web

| url=https://bugs.launchpad.net/ubuntu/+source/dash/+bug/141481

| title=dash as #!/bin/sh introduces countless incompatibilities

| author=comotion

| date=2007-09-21

| publisher=Launchpad

| access-date=2020-02-29}} The problem was first spotted in Ubuntu and the maintainers decided to make all the scripts comply with the POSIX standard. The changes were later upstreamed to Debian, which eventually adopted Dash as its default {{code|/bin/sh}} too in Debian 6 (Squeeze), released in February 2011. As a result, Debian policy was amended to allow script developers to assume a largely POSIX-compliant shell, save for the extensions merged into Dash for convenience ({{code|local}}, {{code|echo -n}}, {{code|test -a / -o}}).{{cite web |title=10. Files |url=https://www.debian.org/doc/debian-policy/ch-files.html#scripts |website=Debian Policy Manual v4.5.0.2}}{{man|1|checkbashisms|ManKier}} A similar transition has happened in Slackware Linux, although its version of {{code|ash}} is only partially based on Dash.

=Embedded Linux=

Ash (mainly the Dash fork) is also fairly popular in embedded Linux systems. Dash version 0.3.8-5 was incorporated into BusyBox, the catch-all executable often employed in this area. Modern BusyBox versions support additional Bash features which are enabled in modern distributions like Alpine Linux, Tiny Core Linux and Linux-based router firmware such as OpenWrt, Tomato and DD-WRT.

See also

References

{{Reflist}}