English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The let command is a tool used in BASH for calculation, which is used to execute one or more expressions. Variables do not need to be prefixed with $ to indicate them in variable calculation. If the expression contains spaces or other special characters, they must be quoted.
let arg [arg ...]
arg: The expression to be executed
Increment Operation:,let no++
Decrement Operation:,let no--
Abbreviated Form ,let no+=10,let no-=20,which is equivalent to ,let no=no+10,let no=no-20.
The following example calculates the results of two expressions a and b and outputs them:
#!/bin/bash let a=5+4 let b=9-3 echo $a $b
The execution results of the above examples are:
9 6