提问人:xNapz 提问时间:11/18/2022 更新时间:11/18/2022 访问量:41
&& if 在 bash 脚本 [duplicate] 中
&& if in bash script [duplicate]
问:
为什么结果总是一样的?,输出总是“好的”。输入值整数
printf "Masukkan nilai IPK : "
read ipk
if [[ $ipk -ge 3,50 && $ipk -le 4,00 ]];
then printf "Awesome"
elif [[ $ipk -ge 2,75 && $ipk -lt 3,50 ]];
then printf "Nice"
elif [[ $ipk -ge 2,00 && $ipk -lt 2,75 ]];
then printf "Good"
else
echo "Sorry"
fi
示例输出代码,如
Input : Masukkan nilai IPK : 3
Output : Good
Input : Masukkan nilai IPK : 4
Output : Good
答: 暂无答案
评论
-gt
-lt
echo $((2,75))
75
echo $((2,00))
[[ $ipk -ge 0 && $ipk -lt 75 ]]