I try to declare a variable x with all chars from a..x. On the command line (bash), substitution of a..x works w/o any ticks.
$ echo {a..x}
a b c d e f g h i j k l m n o p q r s t u v w x
But assigning it to variable via x={a..x} results in {a..x} as string. Only x=$(echo {a..x}) works.
The question is: Is this the proper way of assignment or do I have to do other things?
The main aim is to assign the sequence to an array, e.g.,
disks=( $(echo {a..x}) ) 
                You can also use set (but be sure to save positional parameters if you still need them):
set {a..x}
x="$@"
For arrays, brace expansion works directly:
disks=( {a..x} )
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With