IF语句与括号和方括号之间的差异
在学习一些关于bash的知识的时候 ,我来看看使用if语句的四种方法: 
- 单括号 – (…)
- 双括号 – ((…))
- 单方形支架 – […]
- 双方括号 – [[…]]
bash中括号和方括号有什么区别。
您列出的testing:
- 单个括号 – (…)正在创build一个子shell
- 双括号 – ((…))用于算术运算
-  单方括号 –  […]是POSIX test的语法
-  双方括号 –  [[…]]是bash条件expression式的语法(类似于test但更强大)
不是穷尽的,你可以使用布尔逻辑
 if command; then ... 
 因为这些命令有退出状态。 在bash , 0是true ,> 0是false 。 
你可以看到这样的退出状态:
 command echo $? 
参见:
  http://wiki.bash-hackers.org/syntax/basicgrammar 
  http://wiki.bash-hackers.org/syntax/arith_expr 
  http://mywiki.wooledge.org/BashGuide/TestsAndConditionals