Almquist Shell: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
Line 1: Line 1:
{{implementation|UNIX Shell}}
{{implementation|UNIX Shell}}
'''Almquist Shell''' is a minimal implementation of an almost-[[POSIX]] shell, and also a replacement for [[compatible with::Bourne Shell]]. Almquist Shell has more features than Bourne Shell, but fewer features than most other shells. (No arrays!) Almquist Shell only implements POSIX features, plus a few [[BSD]] traditions, like <code>local</code> variables in functions. Almquist Shell is the default shell, <code>/bin/sh</code>, of some systems. However, it does not have any of the internationalization/localization or multi-byte character encoding support required by the POSIX standard, so it is not a POSIX-compliant shell.
'''Almquist Shell''' is a minimal implementation of an almost-[[POSIX]] shell, and also a replacement for [[compatible with::Bourne Shell]]. Almquist Shell has more features than. the original Bourne Shell, but fewer features than most other shells. (No arrays!) Almquist Shell only implements POSIX features, plus a few [[BSD]] traditions, like <code>local</code> variables in functions. Almquist Shell is the default shell, <code>/bin/sh</code>, of some systems. It does not have any of the internationalization/localization or multi-byte character encoding support required by the POSIX standard, so it is not technically a POSIX-compliant shell, but since it lacks most non-POSIX features, it is helpful in validating that <tt>#!/bin/sh</tt> scripts are not dependent upon such features.


If a script works with Almquist Shell, it will probably also work with [[bash]], [[pdksh]] and [[zsh]]. Further, it will probably work with [[ksh93]] ''unless'' it uses <code>local</code>, which ksh93 lacks.
If a script works with Almquist Shell, it will probably also work with [[bash]], [[pdksh]] and [[zsh]]. Further, it will probably work with [[ksh93]] ''unless'' it uses <code>local</code>, which ksh93 lacks.

Revision as of 20:11, 20 September 2022

Almquist Shell is an implementation of UNIX Shell. Other implementations of UNIX Shell.

Almquist Shell is a minimal implementation of an almost-POSIX shell, and also a replacement for Bourne Shell. Almquist Shell has more features than. the original Bourne Shell, but fewer features than most other shells. (No arrays!) Almquist Shell only implements POSIX features, plus a few BSD traditions, like local variables in functions. Almquist Shell is the default shell, /bin/sh, of some systems. It does not have any of the internationalization/localization or multi-byte character encoding support required by the POSIX standard, so it is not technically a POSIX-compliant shell, but since it lacks most non-POSIX features, it is helpful in validating that #!/bin/sh scripts are not dependent upon such features.

If a script works with Almquist Shell, it will probably also work with bash, pdksh and zsh. Further, it will probably work with ksh93 unless it uses local, which ksh93 lacks.

Almquist Shell filled the need for a free shell to replace Bourne Shell. Kenneth Almquist posted the first version of Ash to Usenet group comp.sources.unix at 30 May 1989. It was a clone of SVR3 Bourne Shell. BSD used Ash for /bin/sh, added features from POSIX, and put a Berkeley copyright on this shell.

Almquist variants

Ash has three major variants:

All three variants have similar features. Dash can run on GNU/Linux.

Ash is also the shell provided by BusyBox.

See also