Skip to content

Commit

Permalink
Merge pull request billie66#200 from Xyinkl/gh-pages
Browse files Browse the repository at this point in the history
一点小修正
  • Loading branch information
happypeter authored Nov 28, 2017
2 parents 0106486 + 8b65dd9 commit 2a070a4
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion book/chap17.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ SSH consists of two parts. An SSH server runs on the remote host, listening for
connections on port twenty-two, while an SSH client is used on the local system to
communicate with the remote server.

SSH 由两部分组成。SSH 服务端运行在远端主机上,在端口 22 上监听将要到来的连接,而
SSH 由两部分组成。SSH 服务端运行在远端主机上,在端口 22 上监听收到的外部连接,而
SSH 客户端用在本地系统中,用来和远端服务器通信。

Most Linux distributions ship an implementation of SSH called OpenSSH from the BSD
Expand Down
6 changes: 3 additions & 3 deletions book/chap18.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ this way:
Our next challenge is how to test for “bad permissions.” How do we do that? Actually
we don’t. What we will test for is “not good permissions,” since we know what “good
permissions” are. In the case of files, we define good as 0600 and for directories, as
0711. The expression that will test files for “not good” permissions is:
0700. The expression that will test files for “not good” permissions is:

下一个挑战是怎样来检查“错误权限”,这个怎样做呢?我们不从这个角度做。我们将测试
下一个挑战是怎样来检查“错误权限”,这个怎样做呢?事实上我们不从这个角度入手。我们将测试
“不是正确权限”,因为我们知道什么是“正确权限”。对于文件,我们定义正确权限为0600,
目录则为0711。测试具有“不正确”权限的文件表达式为:
目录则为0700。测试具有“不正确”权限的文件表达式为:

-type f -and -not -perms 0600

Expand Down
14 changes: 7 additions & 7 deletions book/chap19.md
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ caveat, however: unless you are operating as the superuser, files and directorie
from archives take on the ownership of the user performing the restoration, rather than
the original owner.

如果我们检查 ~/foo/playground 目录中的内容,会看到这个归档文件已经被成功地安装了,就是创建了
如果我们检查 ~/foo/playground 目录中的内容,会看到这个归档文件已经被成功地安装了,也即创建了
一个精确的原始文件的副本。然而,这里有一个警告:除非你是超级用户,要不然从归档文件中抽取的文件
和目录的所有权由执行此复原操作的用户所拥有,而不属于原始所有者。

Expand All @@ -495,8 +495,8 @@ any leading slash from the pathname when creating the archive. To demonstrate, w
recreate our archive, this time specifying an absolute pathname:

tar 命令另一个有趣的行为是它处理归档文件路径名的方式。默认情况下,路径名是相对的,而不是绝对
路径。当创建归档文件的时候,tar 命令会简单地删除路径名开头的斜杠。为了说明问题,我们将会
重新创建我们的归档文件,这次指定一个绝对路径
路径。当以相对路径创建归档文件的时候,tar 命令会简单地删除路径名开头的斜杠。为了说明问题,我们将会
重新创建我们的归档文件,但是这次指定用绝对路径创建

[me@linuxbox foo]$ cd
[me@linuxbox ~]$ tar cf playground2.tar ~/playground
Expand Down Expand Up @@ -1024,11 +1024,11 @@ One of these repositories is kept at Georgia Tech; we could mirror it using our
of rsync and their rsync server like this:

rsync 可以被用来在网络间同步文件的第二种方式是通过使用 rsync 服务器。rsync 可以被配置为一个
守护进程,监听即将到来的同步请求。这样做经常是为了允许一个远程系统的镜像。例如,Red
守护进程,监听即将到来的同步请求。这样做经常是为了进行一个远程系统的镜像操作。例如,Red
Hat 软件中心为它的 Fedora 发行版,维护着一个巨大的正在开发中的软件包的仓库。对于软件测试人员,
在发行周期的测试阶段,镜像这些软件集合是非常有帮助的。因为仓库中的这些文件会频繁地
(通常每天不止一次)改动,定期同步本地镜像,这是可取的,而不是大量地拷贝软件仓库
这些软件库之一被维护在 Georgia Tech;我们可以使用本地 rsync 程序和它们的 rsync 服务器来镜像它。
在发行周期的测试阶段,定期镜像这些软件集合是非常有帮助的。因为仓库中的这些文件会频繁地
(通常每天不止一次)改动,定期同步本地镜像而不是大量地拷贝软件仓库,这是更为明智的
这些软件库之一被维护在乔治亚理工大学;我们可以使用本地 rsync 程序和它们的 rsync 服务器来镜像它。

[me@linuxbox ~]$ mkdir fedora-devel
[me@linuxbox ~]$ rsync -av -delete rsync://rsync.gtlib.gatech.edu/fedora-linux-
Expand Down
6 changes: 3 additions & 3 deletions book/chap20.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ with this command we get an entirely different result (only a partial listing of
is shown). Why is that? It’s a long story, but here’s the short version:

通过这个命令我们得到整个不同的结果(只显示了一部分结果列表)。为什么会是那样?
说来话长,但是这个版本比较简短
说来话长,以下是个比较简短的版本

Back when Unix was first developed, it only knew about ASCII characters, and this
feature reflects that fact. In ASCII, the first thirty-two characters (numbers 0-31) are
Expand All @@ -534,7 +534,7 @@ letters and a few more punctuation symbols. The final thirty-one (numbers 96-127
contain the lowercase letters and yet more punctuation symbols. Based on this
arrangement, systems using ASCII used a `collation order` that looked like this:

追溯到 Unix 刚刚开发的时候,它只知道 ASCII 字符,并且这个特性反映了事实。在 ASCII 中,前32个字符
追溯到 Unix 刚刚开发的时候,它只知道 ASCII 字符,并且Unix特性也如实反映了这一事实。在 ASCII 中,前32个字符
(数字0-31)都是控制码(如 tabs、backspaces和回车)。随后的32个字符(32-63)包含可打印的字符,
包括大多数的标点符号和数字0到9。再随后的32个字符(64-95)包含大写字符和一些更多的标点符号。
最后的31个字符(96-127)包含小写字母和更多的标点符号。基于这种安排方式,系统使用这种排序规则
Expand Down Expand Up @@ -833,7 +833,7 @@ the GNU version of grep also supports extended regular expressions when the -E
option is used.

因为我们将要讨论的下一个特性是 ERE 的一部分,我们将要使用一个不同的 grep 程序。照惯例,
一直由 egrep 程序来执行这项操作,但是 GUN 版本的 grep 程序在使用了-E 选项之后也支持扩展的正则表达式。
一直由 egrep 程序来执行这项操作,但是 GNU 版本的 grep 程序在使用了-E 选项之后也支持扩展的正则表达式。

> POSIX
>
Expand Down
2 changes: 1 addition & 1 deletion book/chap21.md
Original file line number Diff line number Diff line change
Expand Up @@ -1696,7 +1696,7 @@ the possible twenty-six characters, performing the algorithm a second time on th
text restores it to its original form. To perform this encoding with tr:
>
> tr 命令的一个有趣的用法是执行 ROT13文本编码。ROT13是一款微不足道的基于一种简易的替换暗码的
加密类型。把 ROT13称为“加密”是大方的;“文本模糊处理”更准确些。有时候它被用来隐藏文本中潜在的攻击内容。
加密类型。把 ROT13称为“加密”是过誉了;称其为“文本模糊处理”则更准确些。有时候它被用来隐藏文本中潜在的攻击内容。
这个方法就是简单地把每个字符在字母表中向前移动13位。因为移动的位数是可能的26个字符的一半,
所以对文本再次执行这个算法,就恢复到了它最初的形式。通过 tr 命令来执行这种编码:
>
Expand Down
13 changes: 6 additions & 7 deletions book/chap29.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ The line consists of three parts: a variable assignment, a `read` command with a
variable names as arguments, and a strange new redirection operator. We’ll look at the
variable assignment first.

这一行由三部分组成:一个变量赋值,一个带有一串参数的 read 命令,和一个奇怪的新的重定向操作符。
这一行由三部分组成:对一个变量的赋值操作,一个带有一串参数的 read 命令,和一个奇怪的新的重定向操作符。
我们首先看一下变量赋值。

The shell allows one or more variable assignments to take place immediately before a
Expand All @@ -387,9 +387,8 @@ effect of the assignment is temporary; only changing the environment for the dur
the command. In our case, the value of IFS is changed to a colon character. Alternately,
we could have coded it this way:

Shell 允许在一个命令之前立即发生一个或多个变量赋值。这些赋值为之后的命令更改环境变量。
这个赋值的影响是暂时的;只是在命令存在期间改变环境变量。在这种情况下,IFS 的值改为一个冒号。
另外,我们也可以这样编码:
Shell 允许在一个命令之前给一个或多个变量赋值。这些赋值会暂时改变之后的命令的环境变量。
在这种情况下,IFS 的值被改成一个冒号。等效的,我们也可以这样写:

OLD_IFS="$IFS"
IFS=":"
Expand All @@ -416,7 +415,7 @@ wonder why this rather oblique method was chosen rather than:

> You Can’t Pipe read
>
> 你不能管道 read
> 你不能把 管道用在 read
>
> While the read command normally takes input from standard input, you cannot
do this:
Expand All @@ -437,7 +436,7 @@ and its environment which are used to execute the command in the pipeline. In
our example above, read is executed in a subshell.
>
> 答案与 shell 处理管道线的方式有关系。在 bash(和其它 shells,例如 sh)中,管道线
会创建子 shell。这个子 shell 是 shell 和它的环境的副本, 用来执行管线中的命令
会创建子 shell。这个子 shell 是为了执行执行管线中的命令而创建的shell和它的环境的副本
上面示例中,read 命令将在子 shell 中执行。
>
> Subshells in Unix-like systems create copies of the environment for the processes
Expand All @@ -450,7 +449,7 @@ the subshell and its environment are destroyed, and the effect of the assignment
lost.
>
> 在类 Unix 的系统中,子 shell 执行的时候,会为进程创建父环境的副本。当进程结束
之后,环境副本就会被破坏掉。这意味着一个子 shell 永远不能改变父进程的环境。read 赋值变量,
之后,该副本就会被破坏掉。这意味着一个子 shell 永远不能改变父进程的环境。read 赋值变量,
然后会变为环境的一部分。在上面的例子中,read 在它的子 shell 环境中,把 foo 赋值给变量 REPLY,
但是当命令退出后,子 shell 和它的环境将被破坏掉,这样赋值的影响就会消失。
>
Expand Down
6 changes: 3 additions & 3 deletions book/chap30.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ chosen and identified, there is no reason to test for the other selections.
为 while 提供一个退出状态。因为 true 的退出状态总是为零,所以循环永远不会终止。这是一个
令人惊讶的通用脚本编程技巧。因为循环自己永远不会结束,所以由程序员在恰当的时候提供某种方法来跳出循环。
此脚本,当选择"0"选项的时候,break 命令被用来退出循环。continue 命令被包含在其它选择动作的末尾,
为的是更加高效执行。通过使用 continue 命令,当一个选项确定后,程序会跳过不需要的代码。例如,
来提高程序执行的效率。通过使用 continue 命令,当一个选项确定后,程序会跳过不需执行的其他代码。例如,
如果选择了选项"1",则没有理由去测试其它选项。

#### until
Expand Down Expand Up @@ -276,8 +276,8 @@ By changing the test expression to `$count -gt 5`, until will terminate the loop
the correct time. The decision of whether to use the `while` or `until` loop is usually a
matter of choosing the one that allows the clearest `test` to be written.

通过把 test 表达式更改为 $count -gt 5 , until 会在正确的时间终止循环。决定使用 while 循环
还是 until 循环,通常是选择一个 test 可以编写地很清楚的循环
通过把 test 表达式更改为 $count -gt 5 , until 会在正确的时间终止循环。至于使用 while 循环
还是 until 循环,通常是选择其 test 判断条件最容易写的那种

### 使用循环读取文件

Expand Down

0 comments on commit 2a070a4

Please sign in to comment.