bash.sh
· 645 B · Bash
Raw
# Returns true if the numbers are equal
[[ ${arg1} -eq ${arg2} ]]
# Returns true if the numbers are not equal
[[ ${arg1} -ne ${arg2} ]]
# Returns true if arg1 is less than arg2
[[ ${arg1} -lt ${arg2} ]]
# Returns true if arg1 is less than or equal arg2
[[ ${arg1} -le ${arg2} ]]
# Returns true if arg1 is greater than arg2
[[ ${arg1} -gt ${arg2} ]]
# Returns true if arg1 is greater than or equal arg2
[[ ${arg1} -ge ${arg2} ]]
# As with other programming languages you can use AND & OR conditions:
[[ test_case_1 ]] && [[ test_case_2 ]] # And
[[ test_case_1 ]] || [[ test_case_2 ]] # Or
# Опубликовано в https://t.me/gitgate
1 | # Returns true if the numbers are equal |
2 | [[ ${arg1} -eq ${arg2} ]] |
3 | |
4 | # Returns true if the numbers are not equal |
5 | [[ ${arg1} -ne ${arg2} ]] |
6 | |
7 | # Returns true if arg1 is less than arg2 |
8 | [[ ${arg1} -lt ${arg2} ]] |
9 | |
10 | # Returns true if arg1 is less than or equal arg2 |
11 | [[ ${arg1} -le ${arg2} ]] |
12 | |
13 | # Returns true if arg1 is greater than arg2 |
14 | [[ ${arg1} -gt ${arg2} ]] |
15 | |
16 | # Returns true if arg1 is greater than or equal arg2 |
17 | [[ ${arg1} -ge ${arg2} ]] |
18 | |
19 | # As with other programming languages you can use AND & OR conditions: |
20 | [[ test_case_1 ]] && [[ test_case_2 ]] # And |
21 | [[ test_case_1 ]] || [[ test_case_2 ]] # Or |
22 | |
23 | # Опубликовано в https://t.me/gitgate |