- 论坛徽章:
- 1
|
原帖由 yjh777 于 2006-1-27 13:41 发表
我 echo $- 的时候,结果总是 himBH .
$- 到底是什么意思,没找到.
见ABS中对$-的解释:
$−
Flags passed to script (using set). See Example 11−15.
This was originally a ksh construct adopted into Bash, and unfortunately it does not
seem to work reliably in Bash scripts. One possible use for it is to have a script
self−test whether it is interactive
简单的说,$-中存放的是set对shell的一些设置,例如:
/home/lee#echo $-
ilms
/home/lee#set -x
/home/lee#echo $-
+ echo ilmsx
ilmsx
/home/lee#set +x
+ set +x
/home/lee#echo $-
ilms
/home/lee#
[ 本帖最后由 寂寞烈火 于 2006-1-27 14:05 编辑 ] |
|