ash
Provide a lightweight shell interpreter
SYNOPSIS
ash [options] [arguments]
ash -c command_string [command_name [arguments...]]
ash -s [arguments...]
PARAMETERS
-c command_string
Reads commands from the specified command_string and then exits.
-s
Reads commands from standard input. If this option is omitted, commands are read from the first non-option argument or from standard input if no non-option arguments are present.
-i
Forces the shell to run in interactive mode, even if input is not from a terminal.
-v
Prints shell input lines to standard error as they are read. This can be useful for debugging.
-x
Prints commands and their arguments to standard error after parameter expansion and before execution. This is commonly used for script debugging.
-n
Reads commands but does not execute them. This option is useful for checking the syntax of a script without actually running it.
-u
Treats unset variables as an error. If an unset variable is expanded, the shell will print an error message and exit.
-e
Exits immediately if a command exits with a non-zero status. This is often used in scripts to ensure that a failure in one command stops the entire script.
-f
Disables filename generation (globbing). This prevents the shell from expanding wildcard characters like `*` or `?` in filenames.
-m
Enables job control. This allows the user to manage background and foreground processes (e.g., using `Ctrl+Z`, `bg`, `fg`).
--version
Displays the shell's version information and exits.
--help
Displays a help message with common options and exits.
DESCRIPTION
The Almquist Shell, or `ash`, is a compact and fast Unix shell originally developed by Kenneth Almquist. It functions as a faithful, minimalist clone of the Bourne shell (`sh`), emphasizing a small memory footprint and high performance over the extensive features found in shells like `bash` or `zsh`. Due to its efficiency and diminutive size, `ash` is frequently used as the default system shell (`/bin/sh`) in embedded systems, routers, and minimalistic Linux distributions. It adheres closely to the POSIX standard, making it an excellent environment for executing shell scripts designed for maximum portability across various Unix-like operating systems. While it lacks many interactive conveniences of modern shells, its strength lies in the reliable and swift execution of system scripts and its suitability for resource-constrained environments. The Debian Almquist Shell (`dash`) is a widely adopted derivative of `ash`, serving as the default `/bin/sh` on Debian and Ubuntu systems.
CAVEATS
`ash` is intentionally minimalistic and therefore lacks many advanced features common in more feature-rich shells like `bash`, such as sophisticated command-line editing, history expansion, programmable completion, and associative arrays. It is generally not recommended as a primary interactive shell for daily desktop use due to these limitations. Its primary design goal is efficiency and strict POSIX compliance for scripting and embedded environments, not extensive user convenience or rich interactive features.
POSIX COMPLIANCE
`ash` adheres strictly to the POSIX.1-2001 and POSIX.1-2008 standards for shell commands. This strong adherence makes it an ideal environment for developing and testing portable shell scripts that are intended to run across various Unix-like systems without relying on shell-specific extensions or non-standard behaviors.
EMBEDDED SYSTEMS AND MINIMAL ENVIRONMENTS
Due to its minimal memory footprint and fast execution speed, `ash` (and its derivatives like `dash` or the `ash` variant found in BusyBox) is a popular and critical choice for embedded systems, routers, and limited-resource environments. In such scenarios, where every byte of memory and CPU cycle counts, it provides a robust and reliable scripting engine for system initialization, configuration, and various management tasks efficiently.
HISTORY
The Almquist Shell (`ash`) was created by Kenneth Almquist in the late 1980s as a high-performance, small-footprint alternative to the existing Bourne shell. It was designed to be freely redistributable under a BSD license, distinguishing it from earlier proprietary shells. Its efficiency and small size led to its adoption as the default `/bin/sh` in FreeBSD. A significant derivative, the Debian Almquist Shell (`dash`), became the default `/bin/sh` in Debian and Ubuntu distributions around 2006, replacing `bash` for improved system boot times and faster execution of system scripts due to its reduced overhead and faster startup.