What is a shell?

0
5K

At its base, a shell is simply a macro processor that executes commands. The term macro
processor means functionality where text and symbols are expanded to create larger expressions.

A Unix shell is both a command interpreter and a programming language. As a com-
mand interpreter, the shell provides the user interface to the rich set of gnu utilities. The
programming language features allow these utilities to be combined. Files containing com-
mands can be created, and become commands themselves. These new commands have the
same status as system commands in directories such as /bin, allowing users or groups to
establish custom environments to automate their common tasks.
Shells may be used interactively or non-interactively. In interactive mode, they accept
input typed from the keyboard. When executing non-interactively, shells execute commands
read from a file.
A shell allows execution of gnu commands, both synchronously and asynchronously.
The shell waits for synchronous commands to complete before accepting more input; asyn-
chronous commands continue to execute in parallel with the shell while it reads and executes
additional commands. The redirection constructs permit fine-grained control of the input
and output of those commands. Moreover, the shell allows control over the contents of
commands’ environments.
Shells also provide a small set of built-in commands (builtins) implementing function-
ality impossible or inconvenient to obtain via separate utilities. For example, cd, break,
continue, and exec cannot be implemented outside of the shell because they directly ma-
nipulate the shell itself. The history, getopts, kill, or pwd builtins, among others, could
be implemented in separate utilities, but they are more convenient to use as builtin com-
mands. All of the shell builtins are described in subsequent sections.
While executing commands is essential, most of the power (and complexity) of shells
is due to their embedded programming languages. Like any high-level language, the shell
provides variables, flow control constructs, quoting, and functions.

Shells offer features geared specifically for interactive use rather than to augment the pro-
gramming language. These interactive features include job control, command line editing,
command history and aliases. Each of these features is described in this manual.

 

Definitions
These definitions are used throughout the remainder of this manual.


POSIX

A family of open system standards based on Unix. Bash is primarily concerned
with the Shell and Utilities portion of the posix 1003.1 standard.

blank

A space or tab character.

builtin

A command that is implemented internally by the shell itself, rather than by
an executable program somewhere in the file system.

control operator

A token that performs a control function. It is a newline or one of the following:
‘||’, ‘&&’, ‘&’, ‘;’, ‘;;’, ‘;&’, ‘;;&’, ‘|’, ‘|&’, ‘(’, or ‘)’.

exit status

The value returned by a command to its caller. The value is restricted to eight
bits, so the maximum value is 255.

field

A unit of text that is the result of one of the shell expansions. After expansion,
when executing a command, the resulting fields are used as the command name
and arguments.

filename

A string of characters used to identify a file.
job A set of processes comprising a pipeline, and any processes descended from it,
that are all in the same process group.

job control

A mechanism by which users can selectively stop (suspend) and restart (resume)
execution of processes.

metacharacter

A character that, when unquoted, separates words. A metacharacter is a space,
tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.

name

A word consisting solely of letters, numbers, and underscores, and beginning
with a letter or underscore. Names are used as shell variable and function names.
Also referred to as an identifier.

operator

A control operator or a redirection operator. See Section 3.6 [Redirec-
tions], page 38, for a list of redirection operators. Operators contain at least
one unquoted metacharacter.

process group

A collection of related processes each having the same process group id.

process group ID

A unique identifier that represents a process group during its lifetime.

reserved word

A word that has a special meaning to the shell. Most reserved words introduce
shell flow control constructs, such as for and while.

return status

A synonym for exit status.
signal A mechanism by which a process may be notified by the kernel of an event
occurring in the system.

special builtin

A shell builtin command that has been classified as special by the posix stan-
dard.

token

A sequence of characters considered a single unit by the shell. It is either a
word or an operator.

word

A sequence of characters treated as a unit by the shell. Words may not include
unquoted metacharacters.

Source: What is a Shell in Linux? in nanaSEO

Download pdf article by GNU.

 

Like
1
Buscar
Categorías
Read More
Food
Delicious Snack Boxes / Sandwich Packing Bags
One of a kind additional items for nibble boxes can hoist the general insight, making them more...
By Packlim USA 2024-10-07 10:19:26 0 5K
Juegos
MMOexp BnS NEO Classic Divine Gems: Efficient Mob Farming Strategies
Blade & Soul NEO Classic has introduced a variety of exciting events focused on Divine Gems,...
By Tesioao Ddjsi 2025-03-15 02:40:19 0 457
Shopping
Balenciaga Shoes Outlet perfect balance between
Holmes is the latest star to take the tennis shoes for a spin, wearing them on a walk in New York...
By Josephine Flores 2024-05-10 06:38:43 0 7K
Other
কিভাবে নিজে নিজে কানাডার ভিসা করবেন?
কিভাবে কানাডার ভিসা নিজে নিজে করবেন? 🇨🇦 🇪🇺    কানাডা ভিসা এপ্লিকেশন প্রসেস করার সঠিক...
By Visa Aid Limited 2024-06-30 14:45:18 0 6K
Fitness
Nexagen Korea: 장점과 요점별 설문 조사를 읽어보세요!
표준적인 모습을 격노하게 하는 전립선 문제를 조절하는 데 지쳤다고 말할 수 있을까요? 꾸준히 발전하는 전립선 지원 보충제인 Nexagen Korea보다 더 멀리 보지...
By Nexagen Male Enhancement 2024-12-23 13:59:59 0 4K