Skip to content
Search

Arithmetic Expansion

lastmod 2022-10-06created 2022-10-062 edits

Arithmetic Expansion.

bash syntax

z=`expr $z + 3`          # 'expr' 이 확장을 해 줍니다.

Using double parentheses $((...)):

z=$(($z+3))

$((EXPRESSION)) is arithmetic expansion. Do not confuse it with command substitution.

Using let:

let z=z+3

let does not actually perform arithmetic expansion; it performs arithmetic evaluation.

let "z += 3"  # 쿼우트를 해 주면, 빈 칸를 비롯해서 특수한 연산자의 사용이 가능해 집니다.

See also

Favorite site

author Zer0 sitemap