#!/bin/sh
#字符串比较(比较大小以及是否相等)
a=hello
b=hello
c=how
if [[ "$a" == "$b" ]];then #注意对于字符串的相等比较,使用=或==都可以,二者是等价的
echo 'same'
else
echo not same
fi

if [[ "$a"!="$c" ]];then
echo "a!=c"
fi


if [[ "$a" < "$c" ]];then
echo "a<c"
fi

#整数比较
a=1
b=2
if(($a<=$b));then
echo "a<=b"
fi

if((a<=b));then
echo "a<=b"
fi

# 整数运算
d=$(($a+$b))
echo $d

c=$((a+b))
echo $c

# 整数运算
c=$((a+b))
echo $c

#浮点数运算
a=1.223
b=2.3
c=$(echo $a+$b|bc)
echo $c