logical operator and 와 or은 -a, -o로 각각 표현될 수 있다.

주의할 점은 만약 &&를 사용할때는 이중 꺽쐐('[[')을 써야 한다.



출처 :http://debid.vlsm.org/share/LDP/abs/html/comparison-ops.html


compound comparison


logical and

exp1 -a exp2 returns true if both exp1 and exp2 are true.


logical or

exp1 -o exp2 returns true if either exp1 or exp2 are true.

These are similar to the Bash comparison operators && and ||, used within double brackets.

[[ condition1 && condition2 ]]
The -o and -a operators work with the test command or occur within single test brackets.
if [ "$exp1" -a "$exp2" ]

Posted by 김용환 '김용환'

댓글을 달아 주세요