Skip to content

Commit

Permalink
Merge pull request billie66#213 from Hexhu/patch-1
Browse files Browse the repository at this point in the history
审校了第十二章前140行的翻译
  • Loading branch information
happypeter authored Feb 23, 2018
2 parents d3f0923 + c16c235 commit 2125341
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions book/chap12.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ store program settings, some programs will also look for values stored in the en
to adjust their behavior. Knowing this, we can use the environment to customize our
shell experience.

恰如我们之前所讨论到的,shell 在 shell 会话中保存着大量的信息,这些信息称为 (shell) 环境。
存储在 shell 环境中的数据被程序用来确定配置属性。虽然大多数程序用配置文件来存储程序设置,
某些程序也会查找存储在 shell 环境中的数值来调整他们的行为。知道了这些,我们就可以用 shell 环境
来自定制 shell 体验。
恰如我们之前所讲的,shell 在 shell 会话中保存着大量信息。这些信息被称为 (shell 的) 环境。
程序获取环境中的数据(即环境变量)来了解本机的配置。虽然大多数程序用配置文件来存储程序设置,
一些程序会根据环境变量来调整他们的行为。知道了这些,我们就可以用环境变量来自定制 shell 体验。

In this chapter, we will work with the following commands:

Expand Down Expand Up @@ -44,10 +43,10 @@ basically everything else. In addition to variables, the shell also stores some
programmatic data, namely aliases and shell functions. We covered aliases in Chapter 6,
and shell functions (which are related to shell scripting) will be covered in Part 5.

shell 在环境中存储了两种基本类型的数据,虽然对于 bash 来说,很大程度上这些类型是不可
辨别的。它们是环境变量和 shell 变量。Shell 变量是由 bash 存放的少量数据,而剩下的基本上
都是环境变量。除了变量,shell 也存储了一些可编程的数据,即别名和 shell 函数。我们
已经在第六章讨论了别名,而 shell 函数(涉及到 shell 脚本)将会在第五部分叙述
shell 在环境中存储了两种基本类型的数据,虽然 bash 几乎无法分辨这些数据的类型。
它们是环境变量和 shell 变量。Shell 变量是 bash 存放的少量数据。剩下的都是
环境变量。除了变量,shell 也存储了一些可编程的数据,即别名和 shell 函数。我们
已经在第六章讨论了别名,而 shell 函数(涉及到 shell 脚本)将会在本章第五部分叙述

### 检查环境变量

Expand All @@ -56,9 +55,9 @@ stored in the environment. The set command will show both the shell and environm
variables, while printenv will only display the latter. Since the list of environment
contents will be fairly long, it is best to pipe the output of either command into less:

我们可以用 bash 的内建命令 set,或者是 printenv 程序来查看什么存储在环境当中。set 命令可以
显示 shell 和环境变量两者,而 printenv 只是显示环境变量。因为环境变量内容列表相当长,所以最好
把每个命令的输出结果管道到 less 命令
我们可以用 bash 的内建命令 set,或者是 printenv 程序来查看环境变量。set 命令可以
显示 shell 或环境变量,而 printenv 只是显示环境变量。因为环境变量列表比较长,最好
把每个命令的输出通过管道传递给 less 来阅读

[me@linuxbox ~]$ printenv | less

Expand Down Expand Up @@ -103,8 +102,8 @@ The set command, when used without options or arguments, will display both the s
and environment variables, as well as any defined shell functions. Unlike printenv,
its output is courteously sorted in alphabetical order:

当使用没有带选项和参数的 set 命令时,shell 和环境变量二者都会显示,同时也会显示定义的
shell 函数。不同于 printenv 命令,set 命令的输出结果很礼貌地按照字母顺序排列
当使用没有带选项和参数的 set 命令时,shell 变量,环境变量,和定义的 shell 函数
都会被显示。不同于 printenv 命令,set 命令的输出很友好地按照首字母顺序排列

[me@linuxbox ~]$ set | less

Expand All @@ -118,8 +117,8 @@ It is also possible to view the contents of a variable using the echo command, l
One element of the environment that neither set nor printenv displays is aliases. To
see them, enter the alias command without arguments:

如果 shell 环境中的一个成员既不可用 set 命令也不可用 printenv 命令显示,则这个变量是别名
输入不带参数的 alias 命令来查看它们:
别名无法通过使用 set printenv 来查看
用不带参数的 alias 来查看别名:

[me@linuxbox ~]$ alias
alias l.='ls -d .* --color=tty'
Expand All @@ -128,14 +127,14 @@ see them, enter the alias command without arguments:
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

### 一些有趣的变量
### 一些有趣的环境变量

The environment contains quite a few variables, and though your environment may differ
from the one presented here, you will likely see the following variables in your
environment:

shell 环境中包含相当多的变量虽然你的 shell 环境可能不同于这里展示的,但是你可能会看到
以下变量在你的 shell 环境中
shell 环境中包含相当多的变量虽然你的 shell 环境可能与这里的不同,你可能会看到
以下的环境变量

<table class="multi">
<caption class="cap">Table 12-1: Environment Variables</caption>
Expand Down

0 comments on commit 2125341

Please sign in to comment.