From my previous mail:
$ echo $(({1..10}’+’ +0)) # with a space between the first + and the second one

I'm sorry, I assumed that $(()) and (( )) so the exact same thing so I only
included the $(()) version instead of what I tested on my machine.
Apparently both versions do not behave the same.


$ eval echo \$\(\( {1..10}'+' +0\)\)
Works. Adds up to 55, ok.
$ echo $(( {1..10}'+' +0))
Does not work, because:
bash: {1..10}'+' +0: syntax error: operand expected (error token is "{1..10}'+' +0")
So it seems as though bash does not do brace expansion here.

However,
$ (({1..10}'+' +0))
Gives me "bash: ((: 1+ +0 2+ +0 3+ +0 4+ +0 5+ +0 6+ +0 7+ +0 8+ +0 9+ +0 10+ +0: syntax"
which is the same thing I'd get, when I whould've done {1..10}'+ +0'. Thus
in this same arithmetic expansion context bash _does_ indeed do brace expansion. But it does
it after it deleted all whitespace inside the (( )) pair.

Why is that?


Reply via email to