分页: 1 / 1

[问题]请问 set +o 是什么意思?

发表于 : 2007-02-25 16:24
patrickhe
在一篇文章中看到
[ian@pinguino ~]$ set +o nounset
[ian@pinguino ~]$ [ -o nounset ];echo $?
1
[ian@pinguino ~]$ set -u
[ian@pinguino ~]$ test -o nounset; echo $?
0
其中不明白的地方是 set +o 表示什么意思,set -u 又是什么意思?
我直接 man set 没有看到详细的说明档,是不是有更详细的 manual 呢?

多谢!

发表于 : 2007-02-25 16:36
eexpress
man bash

发表于 : 2007-02-25 16:37
patrickhe
在 LinuxCommand.org 查到了。

set +o nounset 表示把 OPTION nounset 设置为 OFF。若是 set -o nounset 的话,则相反,会把 nounset 设置为 ON。

set -u 则表示
Treat unset variables as an error when performing param-
eter expansion. If expansion is attempted on an unset
variable, the shell prints an error message, and, if not
interactive, exits with a non-zero status.

发表于 : 2007-02-25 16:39
patrickhe
eexpress 写了:man bash
谢谢 eexpress。