- 论坛徽章:
- 0
|
walkerxk@www:~$ if [ 9 -gt 10 ];then echo 0;else echo 1;fi
1
walkerxk@www:~$ if [[ 9 -gt 10 ]];then echo 0;else echo 1;fi
1
walkerxk@www:~$ if [[ 9 > 10 ]];then echo 0;else echo 1;fi
0
walkerxk@www:~$ if [ 9 > 10 ];then echo 0;else echo 1;fi
0
walkerxk@www:~$
我这[ $id < $count ]可以,估计是容错了。
[ 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 pri‐
maries 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.
[[ expression ]]
Return a status of 0 or 1 depending on the evaluation of the conditional expression expres‐
sion. Expressions are composed of the primaries described below under CONDITIONAL EXPRES‐
SIONS. Word splitting and pathname expansion are not performed on the words between the [[
and ]]; tilde expansion, parameter and variable expansion, arithmetic expansion, command
substitution, process substitution, and quote removal are performed. Conditional operators
such as -f must be unquoted to be recognized as primaries. |
|