bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Variables declared in arithmetic expressions have no i flag


From: Léa Gris
Subject: Variables declared in arithmetic expressions have no i flag
Date: Tue, 24 Nov 2020 14:30:36 +0100
User-agent: Telnet/1.0 [tlh] (PDP11/DEC)

Should variables automatically created within arithmetic constructs have the integer flag implied?

unset x; ((x = 42)); typeset -p x

> declare -- x="42"

Should it be:
declare -i x="42"


Here are cases where that would make a difference:

unset x; ((x = 42)); x+=624; typeset -p x

> declare -- x="42624"

unset x; declare -i x; ((x = 42)); x+=624; typeset -p x

> declare -i x="666"

--
Léa Gris




reply via email to

[Prev in Thread] Current Thread [Next in Thread]