arg1 -gt arg2 (conditional operator)

true if integer arg1 is greater than integer arg2.

Examples

Different ways to compare two integers:
1
2
3
4
test "$n" -gt 42 && echo "$n > 42"
[ "$n" -gt 42 ] && echo "$n > 42"
# Bash
[[ "$n" -gt 42 ]] && echo "$n > 42"
BashSupport Pro 是一个 支持 -gt 的 Bash 集成开发工具 – 马上试用
© 2020–2024 Joachim Ansorg
声明
隐私政策
许可条款