I want to create a simple bash-script that checks whether a directory contains all the files whose names contain numbers from 1 to N.
# Creating some files for testing
$ cd /tmp/
$ mkdir test
$ touch test/a01x.dat
$ touch test/b02y.dat
# Display dir contents
$ ls test/*{01,02}*
test/a01x.dat test/b02y.dat
But using seq command to generate numbers results in the following:
$ ls test/*{$(seq -s , -f "%02g" 1 2)}*
ls: cannot access 'test/*{01,02}*': No such file or directory
I understand that running the command by surrounding the path with single quotation marks must lead to the error because the wildcards don't expand
$ ls 'test/*{01,02}*'
But I didn't use them. What is the problem?