Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16530
| 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: Return from function depending on number of parameters |
| Date | Fri, 3 Jul 2020 17:39:52 -0400 |
| Lines | 32 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.908.1593812399.2574.bug-bash@gnu.org> (permalink) |
| References | <b1c19d38-64c0-f1ae-d08a-1ada435a0022@gmail.com> <506AA493-0D79-4A9A-A53E-279FDA72CED5@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 1593812399 13040 209.51.188.17 (3 Jul 2020 21:39:59 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Chris Elvidge <celvidge001@gmail.com> |
| 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=q sKEe2OH8/MQ8AeEQlkp8rLwBM3neHne6ckpR872ljA=; b=Xnfmamei3M+ciA0iP Ppr0Ryc3J4OsMOOJHA2X9ntn9MLWKeBrMoW/IKLuh/TSfJgRpIuGw01eLk/JkKpi eGSOzEqsD2+AHZXWz2k601G32CWft/311U0RFulwPdRsI7BuzxbPkK7N9+0+Ux3O jROWNuGwiLlh5aEReyMxRqbskLtLh15XeDdrgU0jFieuvzvY/YCmVPKb9biJcDoU q5cw+o1dvDHWp+sTcv9Z4FrptPn8lCUYFgV2yVtQoE9oUraSQ9QSUxtG4znafful GbZl+pYsjbNPOzgJxnfWwhCvENo9HNaygIWdxnuj5ZjNCF4xYiYV7cjf7ATipbK6 4OU2w== |
| 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=qsKEe2OH8/MQ8AeEQlkp8rLwBM3neHne6ckpR872l jA=; b=X+l0CJXFme2K6qXUE0swZDu8H6z9mroSahiV9ZDYcwVOsVWDeAXWS//4v W6ICsDQPV7eldQEQmM1oyv0lzAFfE1buo+llBcjNnzpGm2hCNKD6jso+Vf2Lkc0h jlHWgyeAvIKzSieKENdy0fcvnWlPi2F3NKo4qvJp4zxKy2WjUBy25Vk9fjwDHxX2 7V0HTh0r6YQjEshd2hk+6VHzExxdfUmHsiQub3/BxNlktPdmeJTUoy/DxWYeWpO+ vnCMjGbXZMV76M+lPrPy2jgDIK6meHUJqgyJ9lQm2UmXFJwwZDRQ05n3WtnNB6Ov 76w8OJV/HN1xjC2LvU36cAdtcEQdg== |
| X-ME-Sender | <xms:qaX_XsuwBfOYy_zdllff4Fek6yp7TRWsC3FT-Y7cqTBRsTlu13Anag> |
| X-ME-Proxy-Cause | gggruggvucftvghtrhhoucdtuddrgeduiedrtdejgddtudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpegtggfuhfgjfffgkfhfvffosehtjehmtdhhtddvnecuhfhrohhmpefnrgifrhgv nhgtvggpgggvlhojiihquhgviicuoehvqheslhgrrhhrhihvrdhmvgeqnecuggftrfgrth htvghrnhepudektdevhedvveevheetkeehieelgeefgeehgeejuefguddtffdvudegleei ieejnecukfhppedutddtrdduvddrudekgedrvdegieenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehvqheslhgrrhhrhihvrdhmvg |
| X-ME-Proxy | <xmx:qaX_XpfEXOMRfxwypNwPOvc12L1QqzOdHvNCpasV-SJXFmjSM2xX1Q> <xmx:qaX_Xny2s0u3pPjuIkqc82xKrF0wQgZaTnJeepBjN95lE4Sxlt8EOg> <xmx:qaX_XvOGq7jjfEbL3B8FXij5PIRzBcasIuzxWdElcCBl3I5-b6Nn4g> <xmx:qaX_XvJJMQt_WKs5ly8Dmq14JYhFVbjj5_D9ah8lwpWUyvfjr1YHXw> |
| In-Reply-To | <b1c19d38-64c0-f1ae-d08a-1ada435a0022@gmail.com> |
| X-Mailer | Apple Mail (2.3445.104.14) |
| Received-SPF | pass client-ip=64.147.123.19; envelope-from=vq@larryv.me; helo=wout3-smtp.messagingengine.com |
| X-detected-operating-system | by eggs.gnu.org: First seen = 2020/07/03 16:52:14 |
| 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 <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 | <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> |
| X-Mailman-Original-References | <b1c19d38-64c0-f1ae-d08a-1ada435a0022@gmail.com> |
| Xref | csiph.com gnu.bash.bug:16530 |
Show key headers only | View raw
> On Jul 3, 2020, at 2:00 PM, Chris Elvidge <celvidge001@gmail.com> wrote: > > However 'N=0; echo $((!$N))' gives an error at the bash prompt. > 'echo $[!$N]' echo's 1 as expected. > > My question - is $[...] actually obsolete? 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. > If so, what should I use at the bash prompt to get the same effect? I expect that the error you encountered was caused by !$ expanding to the last word of the previous command and making the contents of $((...)) an invalid arithmetic expression. This didn't affect your scripts because history expansion is not enabled in non-interactive shells by default. Try inserting a space. $ N=0; printf %s\\n "$((! $N))" 1 You can even drop the $. $ N=0; printf %s\\n "$((! N))" 1 vq
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Return from function depending on number of parameters Lawrence Velázquez <vq@larryv.me> - 2020-07-03 17:39 -0400
csiph-web