yn="GG"
if [ "${yn}" == "GG" ]; then
echo "is the same !!"
fi
shell script 的字串比較方法2 (如果上面判斷行不通):
yn="GG"
yn="GG"
um="GG"
if [ ${yn} == ${um} ]; then
echo "is the same !!"
fi
if [ ${yn} == ${um} ]; then
echo "is the same !!"
fi
shell script 的數字相加:
a="10"
b="20"
c=`expr $a + $b`
shell script 的數字判斷:
declare -i num="60"
if [ $num -gt 50 ]; then
echo "correct !!!"
fi
shell script 的數字累加:
count="1"
count=$(($count+1))
echo "$count"
shell script 的取字串長度:
STR="12345678"
STR="12345678"
LEN=`echo ${#STR}`
echo "STR length is $LEN" => 印出 "STR length is 8"
沒有留言:
張貼留言