arg1 -eq arg2 (conditional operator)
true
if integer arg1
has the same value as integer arg2
.
Please note, that strings are compared by =
or ==
.
Links
Examples
- Different ways to test two integers for equality:
1 2 3 4
test "$n" -eq 42 && echo "the answer is $n" [ "$n" -eq 42 ] && echo "the answer is $n" # Bash [[ "$n" -eq 42 ]] && echo "the answer is $n"
BashSupport Pro ist eine Bash IDE mit Unterstützung für -eq – probieren Sie es aus!