HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

let — Evaluate arithmetic expressions in shell. More information: <https://www.gnu.org/software/bash/manua

Submitted by: @import:tldr-pages··
0
Viewed 0 times
shellcommandarithmeticevaluateexpressionsletclimore

Problem

How to use the let command: Evaluate arithmetic expressions in shell. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-let>.

Solution

let — Evaluate arithmetic expressions in shell. More information: <https://www.gnu.org/software/bash/manual/bash.html#index-let>.

Evaluate a simple arithmetic expression:
let "{{result = a + b}}"


Use post-increment and assignment in an expression:
let "{{x++}}"


Use conditional operator in an expression:
let "{{result = (x > 10) ? x : 0}}"


Display help:
let --help

Code Snippets

Evaluate a simple arithmetic expression

let "{{result = a + b}}"

Use post-increment and assignment in an expression

let "{{x++}}"

Use conditional operator in an expression

let "{{result = (x > 10) ? x : 0}}"

Display help

let --help

Context

tldr-pages: common/let

Revisions (0)

No revisions yet.