|
|
(未显示3个用户的74个中间版本) |
第1行: |
第1行: |
| 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.
| | [[文件:14.png]] |
| | |
| 于其基础,shell是一个简单的用于执行指令的宏处理器。宏处理器这个术语意味着这样的功能,那里一些文本和符号可被扩展成为更大的表达式。
| |
| | |
| A Unix shell is both a command interpreter and a programming language. As a command 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 commands 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.
| |
| | |
| Unix shell既是一个指令解释器也是一种编程语言。作为指令解释器,shell针对丰富的GUN工具提供了用户接口。而它的编程语言特性又允许这些工具可被组合起来。包含指令的文件可以被创建,而它们又成为指令的一部分。这些新指令与在其他目录中的系统指令有着相同的地位例如/bin,并允许用户或组去建立客户环境或自动化他们的公共任务。
| |
| | |
| 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.
| |
| | |
| Shells的使用可以是交互或非交互的。在交互模式下,它们接受键盘输入。在非交互执行时, shells执行可从文件读取。
| |
| | |
| A shell allows execution of GNU commands, both synchronously and asynchronously. The shell waits for synchronous commands to complete before accepting more input; asynchronous 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.
| |
| | |
| 一个shell允许一同步和异步两种方式执行GNU指令。对于同步指令shell等待以完成更多的输入;对于异步指令shell执行读或其它指令是并发执行的。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 functionality 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 manipulate 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 commands. 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 programming language. These interactive features include job control, command line editing, command history and aliases. Each of these features is described in this manual.
| |