带参数扩展的Shell通配符

Jus*_*ner 3 bash shell

我是壳牌的绿手.请参阅我的以下代码.如何让它工作?

[root@localhost ~]# ls {*.txt,*.exe}
a.txt  b.txt  a.exe b.exe
[root@localhost ~]# filter={*.txt,*.exe}
[root@localhost ~]# echo $filter
{*.txt,*.exe}
[root@localhost ~]# ls $filter
ls: {*.txt,*.exe}: No such file or directory
[root@localhost ~]# 
Run Code Online (Sandbox Code Playgroud)

Jon*_*ler 5

这应该做的伎俩:

eval ls $filter
Run Code Online (Sandbox Code Playgroud)