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 programming language. These interactive features include job control, command line editing, history and aliases. Each of these features is described in this manual.
--------------------------------------------------------------------------------
[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
2. Definitions
These definitions are used throughout the remainder of this manual.
POSIX
A family of open system standards based on Unix. Bash is concerned with POSIX 1003.2, the Shell and Tools 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 word 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 blank 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 Redirections, for a list of redirection operators.
process group
A collection of related processes each having the same process group ID.
process group ID
A unique identifer 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 1003.2 standard.
token
A sequence of characters considered a single unit by the shell. It is either a word or an operator.
word
A token that is not an operator.
--------------------------------------------------------------------------------
[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
3. Basic Shell Features
Bash is an acronym for `Bourne-Again SHell'. The Bourne shell is the traditional Unix shell originally written by Stephen Bourne. All of the Bourne shell builtin commands are available in Bash, and the rules for evaluation and quoting are taken from the POSIX 1003.2 specification for the `standard' Unix shell.
This chapter briefly summarizes the shell's `building blocks': commands, control structures, shell functions, shell parameters, shell expansions, redirections, which are a way to direct input and output from and to named files, and how the shell executes commands.
3.1 Shell Syntax What your input means to the shell.
3.2 Shell Commands The types of commands you can use.
3.3 Shell Functions Grouping commands by name.
3.4 Shell Parameters Special shell variables.
3.5 Shell Expansions How Bash expands variables and the various expansions available.
3.6 Redirections A way to control where input and output go.
3.7 Executing Commands What happens when you run a command.
3.8 Shell Scripts Executing files of shell commands.
--------------------------------------------------------------------------------
[ < ] [ > ] [ << ] [ Up ] [ >> ] [Top] [Contents] [Index] [ ? ]
3.1 Shell Syntax
3.1.1 Shell Operation The basic operation of the shell.
3.1.2 Quoting How to remove the special meaning from characters.
3.1.3 Comments How to specify comments.
When the shell reads input, it proceeds through a sequence of operations. If the input indicates the beginning of a comment, the shell ignores the comment symbol (`#'), and the rest of that line. Otherwise, roughly speaking, the shell reads its input and divides the input into words and operators, employing the quoting rules to select which meanings to assign various words and characters.
文章整理:西部数码--专业提供域名注册、虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!




