Say I type:
$ echo cat $(ls -Qv *.pdf)
cat "file 1.pdf" "file 2.pdf"
The output above is what I want to execute. However the following command fails.
$ cat $(ls -Qv *.pdf)
cat: "file: No such file or directory
cat: 1.pdf": No such file or directory
cat: "file: No such file or directory
cat: 2.pdf": No such file or directory
The output here is also what I want but fails without the echo:
echo cat $(ls --quoting-style=escape -v *.pdf)
How do I get around this problem?
Many thanks,
Enda