wildcard expansion in bash script

Viewed 6919

if I write this string in my script:

list=$(ls /path/to/some/files/*/*/*.dat)

it works fine. But what I need is

files="files/*/*/*.dat"
list=$(ls /path/to/some/${files})

and it says

ls: /path/to/some/files/*/*/*.dat: No such file or directory

How should I do it?

2 Answers
Related