On Tue, 21 Apr 2015, Dr Alun J. Carr wrote:
There appears to be a bug in bash when using a variable in curly brace expansion, e.g., {1..$n}. I have put the two following test scripts in the attached files looper1.sh and looper2.sh:
Brace expansion is done before variable expansion: The order of expansions is: brace expansion; tilde expansion, parameter and variable expansion, arithmetic expansion, and command substitution (done in a left-to-right fashion); word splitting; and pathname expansion.
Neither pdksh (which installs as ksh using homebrew) nor dash handle either case correctly:
Neither pdksh nor dash has brace expansion. -- Chris F.A. Johnson, <http://cfajohnson.com>