shell指令碼之if elif寫法

datou-leo發表於2020-11-15
#!/bin/bash
a=100
b=150
if [ $a == $b ]
then
echo "a==b"
elif [ $a -gt $b ]
then
echo "a > b"
elif [ $a -lt $b ]
then
echo "a < b"
else
echo "a b not known"
fi

輸出結果:

a < b

相關文章