bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Space removal in AE takes place before brace expansion


From: Florian Mayer
Subject: Space removal in AE takes place before brace expansion
Date: Sun, 30 Apr 2017 20:31:30 +0200

I want to add up all numbers from 1 to 10, but when I do 
$ echo $(({1,10}’+’ +0)) # with a space between the first + and the second one
I get an error:
bash: ((: 1+ ,3 10+ ,3: syntax error: operand expected (error token is ",3 10+ 
,3“)

It seems as if brace expansion gets executed first (as expected) but with
all the spaces removed that had existed before inside the (( )) parentheses 
pair.
The line
$ (( {1, 10}'+' ,3)) # (space between 1 and 10)
also gives the same error and thus shows that spaces are removed before
brace expansion takes place. Why is that?

I’d consider this a bug, because brace expansion is expected to execute first
and with regards to semantics, spaces are significant...

$ eval echo \$\(\( {1..10}'+' 0\)\)
does the trick, though…


reply via email to

[Prev in Thread] Current Thread [Next in Thread]