Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 601 Bytes

File metadata and controls

23 lines (17 loc) · 601 Bytes

Arithmetic

let

A builtin function of Bash that allows us to do simple arithmetic.

	let <arithmetic expression>

expr

Is similar to let except instead of saving the result to a variable it instead prints the answer.

	expr item1 operator item2

Arithmetic Expansion (Double parentheses)

In the section on Variables we saw that we could save the output of a command easily to a variable. It turns out that this mechanism is also able to do basic arithmetic for us if we tweak the syntax a little.

	$(( expression ))

HOME