Latest web development tutorials

Linux let command

Linux command Daquan Linux command Daquan

Command: let

let BASH command is a tool for calculating for performing one or more expressions, variable calculations do not need to add $ to represent variables. If the expression contains spaces or other special characters, it must be quoted.

Syntax

let arg [arg ...]

Parameter Description:

arg: the expression to be executed

Example:

Self-add operation: let no ++

Decrement operation: let no--

Shorthand let no + = 10, let no- = 20, respectively, equivalent to let no = no + 10, let no = no-20.

The following examples are calculated a and b are two expressions, and outputs the result:

#!/bin/bash

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

The above examples Implementation of the results:

9 6

Linux command Daquan Linux command Daquan