标签:echo res amp == bin shel bash linux (())
代码
#!/bin/bash
# 关系运算符
# 结果是 真/假(1/0)
arg1=4
arg2=5
# 1. <
result1=$((arg1<arg2))
echo $result1
# 2. >
result2=$((arg1>arg2))
echo $result2
# 3. <=
result3=$((arg1<=arg2))
echo $result3
# 4. >=
result4=$((arg1<=arg2))
echo $result4
# 5. ==
result5=$((arg1==arg2))
echo $result5
# 6. !=
result6=$((arg1!=arg2))
echo $result6
# 7. &&
# 坑: 如果 arg1 为 假, 则 arg2 不会被验证
result7=$((arg1&&arg2))
echo $result7
# 8. ||
# 坑: 如果 arg1 为 真, 则 arg2 不会被验证
result8=$((arg1||arg2))
echo $result8
标签:echo res amp == bin shel bash linux (())
原文地址:https://www.cnblogs.com/xy14/p/12090860.html