bash: What is a shell?
1
1 1.2 What is a shell?
1 ====================
1
1 At its base, a shell is simply a macro processor that executes commands.
1 The term macro processor means functionality where text and symbols are
1 expanded to create larger expressions.
1
1 A Unix shell is both a command interpreter and a programming
1 language. As a command interpreter, the shell provides the user
1 interface to the rich set of GNU utilities. The programming language
1 features allow these utilities to be combined. Files containing
1 commands can be created, and become commands themselves. These new
1 commands have the same status as system commands in directories such as
1 '/bin', allowing users or groups to establish custom environments to
1 automate their common tasks.
1
1 Shells may be used interactively or non-interactively. In
1 interactive mode, they accept input typed from the keyboard. When
1 executing non-interactively, shells execute commands read from a file.
1
1 A shell allows execution of GNU commands, both synchronously and
1 asynchronously. The shell waits for synchronous commands to complete
1 before accepting more input; asynchronous commands continue to execute
1 in parallel with the shell while it reads and executes additional
1 commands. The "redirection" constructs permit fine-grained control of
1 the input and output of those commands. Moreover, the shell allows
1 control over the contents of commands' environments.
1
1 Shells also provide a small set of built-in commands ("builtins")
1 implementing functionality impossible or inconvenient to obtain via
1 separate utilities. For example, 'cd', 'break', 'continue', and 'exec'
1 cannot be implemented outside of the shell because they directly
1 manipulate the shell itself. The 'history', 'getopts', 'kill', or 'pwd'
1 builtins, among others, could be implemented in separate utilities, but
1 they are more convenient to use as builtin commands. All of the shell
1 builtins are described in subsequent sections.
1
1 While executing commands is essential, most of the power (and
1 complexity) of shells is due to their embedded programming languages.
1 Like any high-level language, the shell provides variables, flow control
1 constructs, quoting, and functions.
1
1 Shells offer features geared specifically for interactive use rather
1 than to augment the programming language. These interactive features
1 include job control, command line editing, command history and aliases.
1 Each of these features is described in this manual.
1