1

we can build array list of a..z range as the following

example1

list=({a..z})
echo $list
echo ${list[*]}
a b c d e f g h i j k l m n o p q r s t u v w x y z

but in case we want to set variable in the array as the follwing

var=a
list=({$var..z})
echo ${list[*]}
{a..z}

we not get the values from a..z as example1

How to set it so we can print all characters of the alphabet?

ilkkachu
  • 138,973
yael
  • 13,106
  • You cannot achieve that in bash, because range/brace expansion happens before parameter expansion. So it won't know to expand $var – Inian Dec 29 '17 at 11:57
  • @Inian may as well post that as an answer. – terdon Dec 29 '17 at 12:00
  • @terdon: I know ton's of duplicates of this on SO, I thought it should be there here too. If so we could close it – Inian Dec 29 '17 at 12:00
  • or this: https://unix.stackexchange.com/q/55392/170373 well, it's about numbers only – ilkkachu Dec 29 '17 at 12:02

0 Answers0