From https://unix.stackexchange.com/a/7739/674, why does parameter expansion happen before brace expansion in the following example?eval rm foo.{$ext0..$extN}
Why does parameter expansion happen before brace expansion in this example?
bash;variable substitution;brace expansion;eval
It's doing a no-op brace expansion first (expanding to what you started with), then parameter expansion, then brace expansion within eval:# No-op brace expansion example:echo foo.{not..understood}# See: foo.{not..understood}ext0=10extN=20# Parameter expansionecho foo.{$ext0..$extN}# See: foo.{10..20}# Final brace expansioneval echo foo.{$ext0..$extN}# See: foo.10 foo.11 foo.12 foo.13 foo.14 foo.15 foo.16 foo.17 foo.18 foo.19 foo.20# Now if you want to have fun with it (each eval unwraps one level of escapes)eval eval eval eval echo foo.{\\\\\\\$ext0..\\\\\\\$extN}# See: foo.10 foo.11 foo.12 foo.13 foo.14 foo.15 foo.16 foo.17 foo.18 foo.19 foo.20