- 论坛徽章:
- 3
|
原帖由 camperbird 于 2009-1-6 20:19 发表 ![]()
[ -h "$element" -a ! -e "$element" ]
[ -f /usr/bin/netscape -a -f /usr/share/doc/HTML/index.html ]
没见过这样的用法,请教一下是什么意思呀?
man bash
test expr
[ expr ]
Return a status of 0 or 1 depending on the evaluation of the
conditional expression expr. Each operator and operand must be
a separate argument. Expressions are composed of the primaries
described above under CONDITIONAL EXPRESSIONS. test does not
accept any options, nor does it accept and ignore an argument of
-- as signifying the end of options.
Expressions may be combined using the following operators,
listed in decreasing order of precedence.
! expr True if expr is false.
( expr )
Returns the value of expr. This may be used to override
the normal precedence of operators.
expr1 -a expr2
True if both expr1 and expr2 are true.
expr1 -o expr2
True if either expr1 or expr2 is true. |
|