在shell脚本中,我们经常在if语句中看到-ge等字样,下面我们看看这都是什么意思
-eq :equal(相等)
-ne :not equal(不等)
-gt :greater than(大于)
-ge :greater than or equal(大于或等于)
-lt :less than(小于)
-le :less than or equal(小于或等于)
注意:
1、在shell中进行比较时,结果为0代表真,为1代表假。
2、-eq,-ne等比较符只能用于数字比较,有字符也会先转换成数字然后进行比较。