Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14327

Re: Number with sign is read as octal despite a leading 10#

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Number with sign is read as octal despite a leading 10#
Date Tue, 10 Jul 2018 23:17:52 -0400
Organization ITS, Case Western Reserve University
Lines 32
Approved bug-bash@gnu.org
Message-ID <mailman.3415.1531279108.1292.bug-bash@gnu.org> (permalink)
References <CA+n9pTy7vSPUA0j-bDF9_eWF0XysePRDAFckgvvHX8haSWv7KQ@mail.gmail.com> <c8ae5df2-b6b3-438f-bd99-4618f6b2d3c0@Spark> <71850c03-54d3-6a7e-1d29-136950d9e139@iki.fi> <a0b100e7-3e14-e56e-8ffb-fcaeca587bf1@case.edu> <CA+n9pTwOZNdmWqEYwE5cDohArgvZ285vSt-F=hw=ZGb8weO2qA@mail.gmail.com> <471822f3-4484-59b5-0433-fc394dc9b34a@case.edu> <CA+n9pTzNU4stJykWKAJkPzwwrkmxzirWmuUT_xA9U=ZWsh3nMQ@mail.gmail.com>
Reply-To chet.ramey@case.edu
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Trace usenet.stanford.edu 1531279109 24202 208.118.235.17 (11 Jul 2018 03:18:29 GMT)
X-Complaints-To action@cs.stanford.edu
Cc chet.ramey@case.edu
To Isaac Marcos <isaacmarcos100010@gmail.com>, bug-bash@gnu.org, bash@packages.debian.org
Envelope-to bug-bash@gnu.org
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:cc:subject:to:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=cl27HKxokyJjDIhWzDnmfdAzX7yIc9uopoeXYMuwQOI=; b=R/8h8RMGKyBW7V75qcGrA8gKyiyB+FlXDsS1im1sJssYyz79fgjtUaMfxjUlROuSYS l2e1tsPun1aAhp2wV/Qei5rcXlqnTwOi3PVFgUFctVImqV5rvWo8vc7HjPs4EGdWTZKS OB70fLVb/Enda/r4SMotHfaBMvsVeRwmgfF6E3T7exC0kAbDV8P3akbijCRJdW0knvNG 22EeOQ8v9box4kz96sPCx+XoZnAkYr8vKPXNnGtgiQRl+iK2bBGlkGKNvpo0dADDmAhK NzmaIzxtlg8B6FWkDA95iGEKMeuoEizOU7dcY3NNqgqvz8EbZN9RRc5bduDTkpPIW5eS EuyQ==
X-Gm-Message-State APt69E2kFIkty/+/gRJ4cE7T3fFLkwRqWE8F7hy3R0ysHklzuzqRh3Ip 0e5DNNiCSV3W677GsP/jqiIglhQjUn7oOjlidBOZUUyyxH/hYOTYHW4RwlXAHidiOxOx1Ar1MX/ AaF8VeE0y6No=
X-Received by 2002:aed:3d4a:: with SMTP id h10-v6mr26003459qtf.363.1531279101346; Tue, 10 Jul 2018 20:18:21 -0700 (PDT)
X-Google-Smtp-Source AAOMgpe759mSwNGRjes93yBDQRCIwaHE5gEv9Xf0tGBhFF605RLpiBOWEkmeqS20B019zpbEDY2erA==
X-Received by 2002:aed:3d4a:: with SMTP id h10-v6mr26003448qtf.363.1531279101163; Tue, 10 Jul 2018 20:18:21 -0700 (PDT)
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.9.0
In-Reply-To <CA+n9pTzNU4stJykWKAJkPzwwrkmxzirWmuUT_xA9U=ZWsh3nMQ@mail.gmail.com>
Content-Language en-US
X-Junkmail-Status score=7/90, host=mpv4-2015.case.edu
X-Junkmail-PrAS-Raw score=7/90, refid=2.7.2:2018.7.11.22116:17:7.944, ip=, rules=__YOUTUBE_RCVD, __HAS_REPLYTO, __HAS_CC_HDR, __SUBJ_REPLY, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __TO_MALFORMED_2, __TO_NAME, __TO_NAME_DIFF_FROM_ACC, __REFERENCES, __HAS_FROM, FROM_EDU_TLD, __HAS_MSGID, __SANE_MSGID, DATE_TZ_NA, __USER_AGENT, __MOZILLA_USER_AGENT, __MIME_VERSION, __IN_REP_TO, __CT, __CT_TEXT_PLAIN, __CTE, __REPLYTO_SAMEAS_FROM_ADDY, __REPLYTO_SAMEAS_FROM_ACC, __FROM_DOMAIN_IN_ANY_CC1, __FROM_DOMAIN_IN_ANY_CC2, __REPLYTO_SAMEAS_FROM_DOMAIN, __ANY_URI, __URI_WITH_PATH, __URI_NO_WWW, __CP_URI_IN_BODY, __FRAUD_MONEY_CURRENCY_DOLLAR, __SUBJ_ALPHA_NEGATE, __URI_IN_BODY, __URI_NOT_IMG, __FORWARDED_MSG, __NO_HTML_TAG_RAW, BODYTEXTP_SIZE_3000_LESS, BODY_SIZE_1200_1299, __MIME_TEXT_P1, __MIME_TEXT_ONLY, __URI_NS, HTML_00_01, HTML_00_10, __FRAUD_MONEY_CURRENCY, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT, [TRUNCATED], so=2010-03-03 19:42:08, dmn=2016-08-03-0138
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy]
X-Received-From 129.22.103.195
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
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 <http://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>
Xref csiph.com gnu.bash.bug:14327

Show key headers only | View raw


On 7/10/18 4:57 PM, Isaac Marcos wrote:
> Chet Ramey (<chet.ramey@case.edu <mailto:chet.ramey@case.edu>>) wrote:
> 
>     On 7/10/18 2:48 PM, Isaac Marcos wrote:
>     >     That is not an integer constant. Integer constants don't begin
>     with `-'.
> 
> 
> That makes negative numbers invalid.

You need to look at the difference between constants and operators. This is
what allows you to write $(( -a )), for instance.

>     Because of the difference between an operator and a constant. Unary plus
>     and minus have a higher precedence than arithmetic operators. So if you
>     expand the `a' to an expression, which is what happens, the expression
>     consists of an operator (+ or -) and a constant, and that expression has
>     a higher precedence than the +. You might think about why using `$a' in
>     place of the `a' would not work all the time.
> 
> 
> 
> I don't care. All other shells do this correctly. It makes you the only one
> wrong.

"All other shells" is kind of a broad statement.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Number with sign is read as octal despite a leading 10# Chet Ramey <chet.ramey@case.edu> - 2018-07-10 23:17 -0400

csiph-web