On Mon, May 01, 2017 at 03:49:39PM +0200, Florian Mayer wrote: > 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?
Ooh, you fixed your quotes. Yay. To answer your question, I would guess it has something to do with what the bash parser considers a "word". Brace expansion occurs when an unquoted part of a word contains a legitimate brace-expansion substring such as {a,b} or {a..c}. In your case, it looks like the parser considers the entire inside of the arithmetic command to be one "word", with a brace expansion inside it. So, the brace expansion is performed on that word, and you get ((1+ +0 2+ +0 3+ +0 ...)) which you can confirm by re-running your command with set -x.