I am trying to use bash to list the files in the current directory with pattern *{num1..num2}.txt
I have tried to use the bash brace feature
ls *{10..20}.txt
, which works. However when I set the variable num1 and num2 first and then use
num1=10
num2=20
ls a{${num1}..${num2}}.txt
, which actually fails. I have used bash -x
to debug and I found that bash automatically adds single quote to the string a{${num1}..${num2}}.txt
, which is very weird.
Do you have any solution for this?
Thanks.