【问题标题】:Bash Scripting for highest and lowest number最高和最低数字的 Bash 脚本
【发布时间】:2021-12-02 19:51:05
【问题描述】:

如果我希望我的输出是 - 最大数字是 99,最小数字是 -1

我的 bash 脚本称为 maxmin.sh,它要求输入 5 个数字 (3 15 -1 99 22)

如何在我的 bash 脚本中编写它?

【问题讨论】:

  • man sortman headman tail

标签: linux bash numbers script highest


【解决方案1】:

在 Bash 中,您应该签入arithmetic context

if (( a > b )); then
    ...
fi

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-14
    • 1970-01-01
    • 2015-09-30
    相关资源
    最近更新 更多