linux shell 中比较数字 、字符串 大小
2017-04-21 20:59
253 查看
数字的比较:
-eq 相等(equal)
-ne 不等(not equal)
-gt 大于(greater than)
-lt 小于(less than)
-ge 大于等于 (greater than or equal)
-le 小于等于 (less than or equal)
字符串的比较:
[
[
[ -z
[ -n
-eq 相等(equal)
-ne 不等(not equal)
-gt 大于(greater than)
-lt 小于(less than)
-ge 大于等于 (greater than or equal)
-le 小于等于 (less than or equal)
字符串的比较:
[
$str1=
$str2] 等于
[
$str1!=
$str2] 不等于
[ -z
$str] 空字符串返回true
[ -n
$str] 或者 [
$str] 非空字符串返回true
相关文章推荐
- java数字字符串比较大小
- [shell]shell运算(数字[加减乘除,比较大小],字符串,文件)
- JAVASCRIPT中数字字符串比较大小
- js字符串类型的数字比较的大小
- JS中字符串比较大小判断的问题(转数字比较)
- Js、Jquery字符串数字比较大小!
- JavaScript-数字和字符串比较大小
- JavaScript 数字与字符串 比较大小
- 179. Largest Number -- 数字字符串比较大小
- [转]JavaScript 数字与字符串 比较大小
- 解决比较Sql中的数字字符串大小时的注意事项
- javascript中的字符串数字比较大小的问题
- linux c/c++ IP字符串转换成可比较大小的数字
- JavaScript-数字和字符串比较大小
- oracle中字符串的大小比较,字符串与数字的比较和运算
- php两个长数字或字符串的比较大小
- 【Hibernate】字符串形式的数字如何正确的比较大小
- Js、Jquery字符串数字比较大小。
- js字符串与数字比较大小
- jsp 获取两个数值直接用大于、小于比较大小和算加法,不是按数字大小比较,JSP都是以字符串在操作