This code
echo {1..7}
prints 1 2 3 4 5 6 7
.
But this code
t=7
echo {1..$t}
prints {1..7}
.
How do I get {1..$t}
to expand to 1 2 3 4 5 6 7
?
This code
echo {1..7}
prints 1 2 3 4 5 6 7
.
But this code
t=7
echo {1..$t}
prints {1..7}
.
How do I get {1..$t}
to expand to 1 2 3 4 5 6 7
?
You don't. Use e.g. seq
for that, because brace expansion is performed before any other expansions and eval
is evil :-)
$ a=5
$ seq 1 $a
1
2
3
4
5