Linux Learning Record--Bash Variable Numerical Operations and Operators

In the shell transformation of linux, when performing numerical operations, it is often necessary to use $(()) or $[] to surround variables, and the variables in parentheses can be added, subtracted, multiplied and divided according to mathematical symbols.
As follows:
aa=1
bb=2
cc=$(($aa+$bb))

, the result of cc is 3. If aa+bb is used directly, the result of cc is 1+2. Only the content of the variable is added into the When in $(()) or $[], it is the numerical operation and the operation with the numerical operation operator.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326224316&siteId=291194637