什么是"-le"?在shell脚本? [英] What is "-le" in shell script?
问题描述
我正在通过此代码.我想知道这是什么意思
-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屋!