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

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

 

 

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

 

compound comparison

-a

logical and

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

-o

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" ]

'unix and linux' 카테고리의 다른 글

특정 시간마다 로그 파일 지우기.  (0) 2007.10.09
shell에서 하루 전 날짜 구하기  (0) 2007.10.09
bash에서 스트링 비교하기  (0) 2007.10.09
Bash에서 숫자 비교  (0) 2007.10.09
Bash 간단한 내용 정리  (0) 2007.10.09
Posted by '김용환'
,