bash에서 숫자 비교를 다음과 같이 쓸수 있다.

 

 

출처 :

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

 

 

-eq

is equal to

if [ "$a" -eq "$b" ]

-ne

is not equal to

if [ "$a" -ne "$b" ]

-gt

is greater than

if [ "$a" -gt "$b" ]

-ge

is greater than or equal to

if [ "$a" -ge "$b" ]

-lt

is less than

if [ "$a" -lt "$b" ]

-le

is less than or equal to

if [ "$a" -le "$b" ]

<

is less than (within double parentheses)

(("$a" < "$b"))

<=

is less than or equal to (within double parentheses)

(("$a" <= "$b"))

>

is greater than (within double parentheses)

(("$a" > "$b"))

>=

is greater than or equal to (within double parentheses)

(("$a" >= "$b"))

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

bash에서의 String(스트링) 비교  (0) 2007.10.09
bash에서 스트링 비교하기  (0) 2007.10.09
Bash 간단한 내용 정리  (0) 2007.10.09
zagent 좀비 프로세스.  (0) 2007.10.08
포트 충돌 (zagent)  (0) 2007.10.08
Posted by '김용환'
,