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


Groups > gnu.bash.bug > #14943 > unrolled thread

Re: Error on arithmetic evaluation of `~0`.

Started byChet Ramey <chet.ramey@case.edu>
First post2018-12-22 12:02 -0500
Last post2018-12-22 12:02 -0500
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Error on arithmetic evaluation of `~0`. Chet Ramey <chet.ramey@case.edu> - 2018-12-22 12:02 -0500

#14943 — Re: Error on arithmetic evaluation of `~0`.

FromChet Ramey <chet.ramey@case.edu>
Date2018-12-22 12:02 -0500
SubjectRe: Error on arithmetic evaluation of `~0`.
Message-ID<mailman.6138.1545498179.1284.bug-bash@gnu.org>
On 12/20/18 8:12 AM, Greg Wooledge wrote:

> The issue you're reporting appears to be present in arithmetic contexts
> in general, not only arrays:
> 
> wooledg:~$ echo $((~0))
> bash: /home/wooledg: syntax error: operand expected (error token is "/home/wooledg")

This is what was fixed post-bash-4.4. I left the array subscript expansion
unchanged for backwards compatibility.

> It appears that bash is performing tilde expansion when there's no
> whitespace in front of the tilde, or bitwise negation if there is
> whitespace.

Because tilde expansion only happens on the first character of a string,
or following an unquoted `=' or `:'.

Chet
-- 
``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/

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web