Easy Tutorial
❮ Linux Comm Pkill Linux Comm Declare ❯

Linux let Command

Linux Command Manual

Command: let

The let command is a tool in BASH for performing calculations. It is used to execute one or more expressions, where variables do not need to be prefixed with $ in the calculation. If the expression contains spaces or special characters, it must be quoted.

Syntax Format

let arg [arg ...]

Parameter Description:

arg: The expression to be executed

Examples:

Increment operation: let no++

Decrement operation: let no--

Shorthand forms let no+=10, let no-=20, which are equivalent to let no=no+10, let no=no-20.

The following example calculates the expressions for a and b, and outputs the results:

#!/bin/bash

let a=5+4
let b=9-3 
echo $a $b

The result of the above example is:

9 6

Linux Command Manual

❮ Linux Comm Pkill Linux Comm Declare ❯