Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16603
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Lawrence Velázquez <vq@larryv.me> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Integer (re)declaration keeps string values |
| Date | Wed, 22 Jul 2020 04:48:30 -0400 |
| Lines | 31 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.318.1595407719.24492.bug-bash@gnu.org> (permalink) |
| References | <courier.000000005F17F4DE.000F3004@charon.podzimek.org> <6B0FBD2F-3194-4642-8F72-929778D0AE79@larryv.me> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1595407719 19478 209.51.188.17 (22 Jul 2020 08:48:39 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | andrej@podzimek.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=larryv.me; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm1; bh=9 sBzx1KI/kFZiiuSfyja8wyrDgHGHS90+I51W3u3HYc=; b=AGXkncqNPFe9JNCJm 6thMfV84Bx9NtSjrFrVJpMy2uur4vZXuK3FNrj16A0pW8NSF9QuYHI/5MCqeLEOU YbSAqlSaFp+apu5I5bg/RkU7udrxOf7bZ7/V84EU8PVrDbfmrF7gSggnYBJHnCzs tg4PIJrv/no05pdCW15hI2t1uhjPmTlQfQWGgWCytDDAu1Q+dpkMGnffeUNRZD4d ca4bJICc94uv0iuZn063gtRA7rsGFaTHXI21HTRaWTdouT6bIYcI5/nmf1wPS9UD kAwPNQ1qW5Mz9Wi4y9Pm/3jB4RSPl6LgTMHZymbflP2q2NU0g9OIUjbDSeicEFNL 3Wjqw== |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=9sBzx1KI/kFZiiuSfyja8wyrDgHGHS90+I51W3u3H Yc=; b=NYoM+arvjiPSiW/2k3eWi4ihlPMrl1JoA/S+E/DG616cLLdRT4KQ/s9Ci j3OyrQDg6iGyJ4aR5EzGzf0OS/fUqJSA/bEzthH1CwvFSLSB2llDgaGKf/VZMdMc biiceW2WX0tk6JEqIGOV7YWt4nfDqR7t4veqP7Sos/4qYcHVeBmLQjk2qR+KOFu/ TKWbOeEpiGnwH4+vtSg97pIxj1KGV1wBEv4bg3171gF96ljgDC02udOaaS4O75Pa D4m4YKNc/5rAWKOEFvjU7Gc2lOcG+ux3wbZJhy34GyYi+6TIT6lGnnLAWWb3o+/D Kfw634WSh08/gXN/id3dkZU8c5X4Q== |
| X-ME-Sender | <xms:YP0XXwJtsWQYBn2jJ09MGZRjA2XMi7BcVMPCG7xFx-gcBYImCWIY6w> |
| X-ME-Proxy-Cause | gggruggvucftvghtrhhoucdtuddrgeduiedrgeelgddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesthejmh dthhdtvdenucfhrhhomhepnfgrfihrvghntggvpgggvghljoiiqhhuvgiiuceovhhqsehl rghrrhihvhdrmhgvqeenucggtffrrghtthgvrhhnpedukedtveehvdevveehteekheeile egfeegheegjeeugfdutdffvddugeelieeijeenucfkphepudejvddrheekrddvfedurddu udeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvh hqsehlrghrrhihvhdrmhgv |
| X-ME-Proxy | <xmx:YP0XXwJSScmIWcZj_CSGuTk7NC7bgO-NnfFNiJhL58A-bGw_H4kMXw> <xmx:YP0XXwsPHuHQenLkhf9TEp6zzqXgv-PBcoKYxIF6hvZDrBUI09RrGw> <xmx:YP0XX9a1V4hADC3H3Pz3_MjzZb4HRiwWyzGcFciDP-Dw_JdS7fN5_w> <xmx:YP0XXwm2LbngPS9wfmYWJQh86MVvWp5j_GXEtCKgIALlZlqMBzj8lQ> |
| In-Reply-To | <courier.000000005F17F4DE.000F3004@charon.podzimek.org> |
| X-Mailer | Apple Mail (2.3445.104.14) |
| Received-SPF | pass client-ip=64.147.123.25; envelope-from=vq@larryv.me; helo=wout2-smtp.messagingengine.com |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/07/22 04:48:33 |
| X-ACL-Warn | Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Spam_score_int | -27 |
| X-Spam_score | -2.8 |
| X-Spam_bar | -- |
| X-Spam_report | (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no |
| X-Spam_action | no action |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <6B0FBD2F-3194-4642-8F72-929778D0AE79@larryv.me> |
| X-Mailman-Original-References | <courier.000000005F17F4DE.000F3004@charon.podzimek.org> |
| Xref | csiph.com gnu.bash.bug:16603 |
Show key headers only | View raw
> On Jul 22, 2020, at 4:12 AM, andrej--- via Bug reports for the GNU
> Bourne Again SHell <bug-bash@gnu.org> wrote:
>
> Description:
> Integer variables don't get (re)parsed when (re)declared.
>
> Repeat-By:
> a=z
> declare -i a
> echo $a # z (I'd expect emptiness or 0)
The man page explicitly says that arithmetic evaluation is performed
*on assignment*.
-i The variable is treated as an integer; arithmetic evaluation
(see ARITHMETIC EVALUATION above) is performed when the
variable is assigned a value.
Sure enough:
% bash
bash-5.0$ a=z
bash-5.0$ declare -i a
bash-5.0$ echo "$a"
z
bash-5.0$ a=z
bash-5.0$ echo "$a"
0
vq
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Integer (re)declaration keeps string values Lawrence Velázquez <vq@larryv.me> - 2020-07-22 04:48 -0400
csiph-web