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: Return from function depending on number of parameters Date: Sat, 4 Jul 2020 12:23:45 -0400 Lines: 50 Approved: bug-bash@gnu.org Message-ID: References: <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> <0b8f32e5-0644-526e-59a4-1bad5a474262@passchier.net> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.14\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1593879834 21889 209.51.188.17 (4 Jul 2020 16:23:54 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: pepa65 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=fm3; bh=v MQ5YisXvzQZWIa2gsHIPE6P3P4xStiSM1tY1M8sigI=; b=gioz8vOgXSj/gODDV faSOV94JrpKWEwEqKCMX5rPSTEuO6DIUDrvXdaOpM448Dr7Hm1XSmxpZeT5MSCdO 7GiFsJI4ifotKzWy3VPlOKMvZ26syJFCph2GyK88D81fBRCA0jvReOiHH3AJt944 X57AYubJ3tznNOPo9JEYAvzbccjGaPAb942dRXxsn1aCxx9YEAsQVMIi2ainIi5m l392k72sT0Aqt+F01awkkjzi8I2ZInjVs0OdTyDH/iXm1/r4vCaGmCqSePbj7vfN kvW8E+iUq9XRXeqaYXCTQRtSWCIg5+BoCauCILHC9b4/2sB14Tc/Ks9Sr37AAkGu hMscg== 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=vMQ5YisXvzQZWIa2gsHIPE6P3P4xStiSM1tY1M8si gI=; b=IAPBenhvH5HLxB16rJV0HqdLTckngoMk6f/3sWWUAA9ppfc5H07kbXMGs kUnLDw+MtgAUB7AFTytvnNzGE4AnsWTcEuZNctCrukf2VWurOcF0BYupP/Qkb1Bm T93sKaeFilw6u8X4LCVZ4Ejh1ggfqrNJk++VEQMKaR+wk6fr33mAU5mdNgX/cFM8 cUDeYygW0EJzCKjaD24OB32sShb+wSWHaXPH96Tgt2SSpJur9KAIrZXlyNoCdb30 Yozzr5SS0xMuBPOFmunX7zWAcFWhOozvFG2ki4ZEu7OMMXkses2DdwqPUjA11ckK co+D5FpxB9GaxQ7zc9+1g5eC+X2GQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrtdekgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpegtggfuhfgjfffgkfhfvffosehtqh hmtdhhtdejnecuhfhrohhmpefnrgifrhgvnhgtvggpgggvlhojiihquhgviicuoehvqhes lhgrrhhrhihvrdhmvgeqnecuggftrfgrthhtvghrnhepjeefudetgfetheegkefgueevhf ejgeekvdejudelkeejvddtleetueevuddtfeeunecuffhomhgrihhnpehgnhhurdhorhhg necukfhppedutddtrdduvddrudekgedrvdegieenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg X-ME-Proxy: In-Reply-To: <0b8f32e5-0644-526e-59a4-1bad5a474262@passchier.net> X-Mailer: Apple Mail (2.3445.104.14) Received-SPF: pass client-ip=66.111.4.25; envelope-from=vq@larryv.me; helo=out1-smtp.messagingengine.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/04 12:23:47 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=_AUTOLEARN 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: X-Mailman-Original-References: <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> <0b8f32e5-0644-526e-59a4-1bad5a474262@passchier.net> Xref: csiph.com gnu.bash.bug:16538 > On Jul 4, 2020, at 8:12 AM, pepa65 wrote: >=20 > On 04/07/2020 04.39, Lawrence Vel=C3=A1zquez wrote: >> It might tell you something that $[...] is not even mentioned in >> the man page for bash 3.2.57, which is decidedly not the current >> version. >=20 > About that, is it for sure that $[] is going to be obsoleted/removed = in > the future? Only Chet knows for sure, but "obsolete" need not mean "removed". Given how thoroughly it's been memory-holed, $[...] is about as obsolete as it can get. Removing it would break a lot of old scripts, though. > I happened to use it recently Inadvisable. > and thought it was more readable than $(()) and caused less visual > clutter. Any reason $(()) was preferred? Quoting Chet liberally from https://lists.gnu.org/archive/html/bug-bash/2012-04/msg00034.html: > On 4/7/12 4:45 PM, Linda Walsh wrote: >=20 >> In modifying some released code on my distro, I ran into the = extensive use >> of $[arith] as a means for returning arithmetic evaluations of the >> expression. >>=20 >> I vaguely remember something like that from years ago, but never see = any >> reference to >> it -- yet it works, and old code seems to rely on it -- and >> "$[(1+2)/3]" looks cleaner than "$(((1+2)/3))". So what's up with = that? >=20 > It dates from Posix circa 1990 (1003.2d9, of which I've lost my paper > copy). I implemented it after the Berkeley guys, mostly Marc > Teitelbaum, put it into Posix. It ended up getting dropped in favor > of the ksh $((...)) expansion, at which point everyone deprecated the > old $[...]. I removed it from the manual sometime later, but it still > works as it always has. vq=