📌  相关文章
📜  如何在 shell 脚本中比较浮点值 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:51:45.313000             🧑  作者: Mango

代码示例1
# comparing floting points
compare=`echo | awk "{ print ($x < $y)?1 : 0 }"`
echo compare=$compare

if [[ $compare -eq 1 ]]; then
    echo x=$x is less than y=$y
elif [[ $compare -eq 0 ]]; then
    echo y=$y is less than x=$x
fi