Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #16532
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Chris Elvidge <celvidge001@gmail.com> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Return from function depending on number of parameters |
| Date | Sat, 4 Jul 2020 12:01:44 +0100 |
| Lines | 52 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.929.1593860511.2574.bug-bash@gnu.org> (permalink) |
| References | <b1c19d38-64c0-f1ae-d08a-1ada435a0022@gmail.com> <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> <cbea0e99-93de-b526-5af0-9484ab7a99b0@gmail.com> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | usenet.stanford.edu 1593860512 10577 209.51.188.17 (4 Jul 2020 11:01:52 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | bug-bash@gnu.org |
| To | Lawrence Velázquez <vq@larryv.me> |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=CSEP9N8UhCJEBcv3CeyYNu8BXe70THxzS2Yer4JI6iY=; b=MYk4BwMWzIJtmGVjUQecoH7Vgl/jBiL4VXHuTjhqfAlgZX4sKPBZg5gLvM/U1I52yY hYkEDATOWZdwuksh3eCziL2v2PNEU/3MVHmlmnRE4tuLKJpydJaxUTCBKNzPFyX7Rygi ovfbZ4DLCQuQ4MSaltpXOFSaMkY5IAA4Yg4t9VtjK+FYxorVig2LSiGHMVPG/VLAvGG7 9BjXqA6KNivP7v9AVRQPP9GV9+G/OBMRreevUGnb5NdmZQJ7LP5NXnYDRuENi2CdM/AB zs8wDemKtndaXQwh+H4X3SRHCJLUfCCzH/0tHDmPcA7xitMxrcR8VWtZGfn6QViH2qW4 1yWg== |
| X-Google-DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CSEP9N8UhCJEBcv3CeyYNu8BXe70THxzS2Yer4JI6iY=; b=LLV3gP3Exiz2cR70uhOjJADpkGOi9ysvUwkmhRb16BxdIEBN0zf9CixQh1xSuYG1+z y0LvqKxxkBncH4FqGABar2Pu1i1buPVF2IqS4h+bBnc3eu4+cLm6Q48i3KVWsgsjuiZj syaRaN1P0S88aBMbvJdZKEwuuMFhrFlyw11D1v5zUxtbti0rxwMyVRJ2fIcbaSJiYlnR 4UPs+SiaRWN0jzwPpYVSyPbl1oFFF5Hc2UYoHDDe0YCInbioi4OoZnSzvloPt+2mUe3z Q3naZsXw9cmDdwFVXG6easOQGO3cGgIGNuFAuprs/WmL8T3ibCFxG9ogEDf/wmspOraj 2Qow== |
| X-Gm-Message-State | AOAM531GXz+CDTRnFBaqFviWqqrK5bLeGM1QGYuiPL27T07Kwl5yRGaS tfELh/DNMy3gSf2JlK3g3jtP/6hb |
| X-Google-Smtp-Source | ABdhPJyb9bESa8+6dmDCkfDf2noLEzwPjYSf4Td6tTKuvd8KU8cWqcQIVAReEr7GN6wbvZHW9k17fw== |
| X-Received | by 2002:adf:fd8e:: with SMTP id d14mr40502592wrr.202.1593860506896; Sat, 04 Jul 2020 04:01:46 -0700 (PDT) |
| User-Agent | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
| In-Reply-To | <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> |
| Content-Language | en-GB |
| Received-SPF | pass client-ip=2a00:1450:4864:20::431; envelope-from=celvidge001@gmail.com; helo=mail-wr1-x431.google.com |
| X-detected-operating-system | by eggs.gnu.org: No matching host in p0f cache. That's all we know. |
| X-Spam_score_int | -7 |
| X-Spam_score | -0.8 |
| X-Spam_bar | / |
| X-Spam_report | (-0.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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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 | <cbea0e99-93de-b526-5af0-9484ab7a99b0@gmail.com> |
| X-Mailman-Original-References | <b1c19d38-64c0-f1ae-d08a-1ada435a0022@gmail.com> <506AA493-0D79-4A9A-A53E-279FDA72CED5@larryv.me> |
| Xref | csiph.com gnu.bash.bug:16532 |
Show key headers only | View raw
On 03/07/2020 10:39 pm, Lawrence Velázquez wrote: >> 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 > Thanks for the info. It also explains why I couldn't find a reference to $[...] except in the reference I quoted. -- Chris Elvidge 5 Ebor Park, Appleton Roebuck, York. YO23 7DZ. Tel (Mob): +447443472958 mailto:celvidge@outlook.com Calle Padre Raimundo Codesal 1, Vélez-Málaga, 29700, España
Back to gnu.bash.bug | Previous | Next | Find similar
Re: Return from function depending on number of parameters Chris Elvidge <celvidge001@gmail.com> - 2020-07-04 12:01 +0100
csiph-web