【原文地址】:http://tec110505.diandian.com/post/2011-08-26/4369752
shell 中括号
[[]]
1. [[]]结构比[]结构更加通用。这是一个扩展的test命令,是从ksh88中引进的。
2. [[]]支持&& ||> < 而[] 只支持test支持的条件判断
(( ))
# (( ... ))结构可以用来计算并测试算术表达式的结果。
# 退出状态将会与[ ... ]结构完全相反!
(( 0 ))
echo "Exit status of \"(( 0 ))\" is $?."
(( 1 ))
echo "Exit status of \"(( 1 ))\" is $?."
(( 5 > 4 ))
echo "Exit status of \"(( 5 > 4 ))\" is $?."
Exit status of "(( 0 ))" is 1.
Exit status of "(( 1 ))" is 0.
Exit status of "(( 5 > 4 ))" is 0.