Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= 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: References: <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: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrgeelgddtkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurheptggguffhjgffgffkfhfvofesthejmh dthhdtvdenucfhrhhomhepnfgrfihrvghntggvpgggvghljoiiqhhuvgiiuceovhhqsehl rghrrhihvhdrmhgvqeenucggtffrrghtthgvrhhnpedukedtveehvdevveehteekheeile egfeegheegjeeugfdutdffvddugeelieeijeenucfkphepudejvddrheekrddvfedurddu udeinecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepvh hqsehlrghrrhihvhdrmhgv X-ME-Proxy: In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <6B0FBD2F-3194-4642-8F72-929778D0AE79@larryv.me> X-Mailman-Original-References: Xref: csiph.com gnu.bash.bug:16603 > On Jul 22, 2020, at 4:12 AM, andrej--- via Bug reports for the GNU > Bourne Again SHell 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