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

查看:16
本文介绍了什么是“-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 在 Linux 中的意思是 小于或等于<=

-le in Linux means less that or equal to i.e. <=

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

Means -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天全站免登陆