- 论坛徽章:
- 84
|
The [[ ]] construct is the more versatile Bash version of [ ]. This is the extended test
command, adopted from ksh88.
Bash版本中,[[]]结构比[]更加万能/多才多艺,它是test命令的扩展,从ksh88中借鉴而来。
Using the [[ ... ]] test construct, rather than [ ... ] can prevent many logic errors in scripts.
For example, the &&, ||, <, and > operators work within a [[ ]] test, despite giving an
error within a [ ] construct.
相对[]而言,在脚本里使用[[]]结构可以防止许多逻辑错误。例如:在[[]]中使用&&, ||, <,
和 >这些操作符可以正常工作,而在[]中直接使用可能会出错。
__________________________________________________________________________
上面的英文介绍来自:
Advanced Bash-Scripting Guide(An in-depth exploration of the art of shell scripting)
[ 本帖最后由 yjh777 于 2006-4-13 20:34 编辑 ] |
|