I would like to perform command substitution before brace expansion, but couldn't:
$ ls {$(seq -s , 13 20)}.pdf
ls: cannot access {13,14,15,16,17,18,19,20}.pdf: No such file or directory
How can I do it?
bashbrace-expansioncommand-substitution
I would like to perform command substitution before brace expansion, but couldn't:
$ ls {$(seq -s , 13 20)}.pdf
ls: cannot access {13,14,15,16,17,18,19,20}.pdf: No such file or directory
How can I do it?
Best Answer
You simply need to use the
eval
shell builtin:Where
eval
takes the arguments passed to it:ls {$(seq -s , 13 20)}.pdf
and concatenates them together into a single command:
which is then read and executed by the shell.