小编use*_*579的帖子

以 bash 开头:-lt 和 -gt 参数

我从 bash 开始,发现以下内容:

if test $first -lt $second
then
  echo $first is lower than $second
else
  if test $first -gt $second
  then
    echo $first is higher than $second
  else
    echo $first and $second are equals
  fi
fi
Run Code Online (Sandbox Code Playgroud)

为了阅读脚本并执行它,我知道它的作用,但不知道 -lt 和 -gt 的用途。

有人可以告诉我这种“工具”的名称是什么以及它们(-lt 和 -gt)是做什么的?谢谢!

shell bash test

32
推荐指数
2
解决办法
26万
查看次数

标签 统计

bash ×1

shell ×1

test ×1