Get the App
SLTechnology News&Howtos  ›  Network Security  › 

How many operation methods are there in shell

Shulou Source: shulou.com Published: 2022-05-31 21:41:37 10月03日 Update

This article will explain in detail how many operation methods there are in shell. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Normal addition, multiplication and division operation of a.expr Note: expr can only operate on integers

Expr 2 + 2

Expr 2-2

Expr 2\ * 2

Expr 2 / 2

Note:

1. There is at least one space around the operator and the calculated number

two。 To use a multiplication sign, a backslash must be used to mask its specific meaning.

B.expr reference variable

Usage 1

# iTunes 1

# I = `expr $I + 1`

Usage 2

# axi2

# bread3

# expr $[aqb] or # expr $[$aquib]

Usage of c.$ (()) Note: the most efficient calculation method

# ((aq1 / 2 / 3 / 3))

# echo $a

The usage of d.let

# iTunes 1

# let i=i+100

This is the end of this article on "how many calculation methods are in shell". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.

Tags: Operations methods articles more good practical highest multiplication division content addition variables meaning efficiency numbers integers articles slashes knowledge spaces Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux OPPO Reno Huawei Apple macOS