wildcard expansion in bash script

bash

Solution

Try this:

list=$(find /path/to/some/files/ -mindepth 3 -maxdepth 3 -name '*.dat')

Problem

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?

Original source