什么是"-le"?在shell脚本? [英] What is "-le" in shell script?

查看:1093
本文介绍了什么是"-le"?在shell脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过此代码.我想知道这是什么意思 -le在以下代码段中.

I am going through this code. I would like to know what is meant by -le in the following code segment.

if [ $stage -le 2 ]; then

在一个问题中,它说-le代表字符串的<=,但这在Perl中.这里也一样吗?

In one of the questions it says that -le stands for <= of strings, but that is in Perl. Is it the same here as well?

此外,我想知道该$stage变量是否自动更新.它在一开始就已初始化为0,但是后来如何递增呢?

Further, I would like to know if that $stage variable automatically gets updated. It has been initialized to 0 at the beginning, but later, how does that get incremented?

推荐答案

-le检查左操作数的值是否小于或等于 (<=)右操作数的值,如果是,则条件变为true.

-le checks if the value of left operand is less than or equal to (<=) the value of right operand, if yes then condition becomes true.

考虑:

$a=10
$b=20

然后[ $a -le $b ]是真的.

这篇关于什么是"-le"?在shell脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆