On 08/19/2013 11:51 AM, Enda wrote:
> Say I type:
> 
> $ echo cat $(ls -Qv *.pdf)

Insufficient quoting.  Try:

$ echo cat "$(ls -Qv *.pdf)"

and to really see the difference, first do
 touch "two  spaces.pdf"
in the directory.  But even then, that only shows the input that you
want, but would still require an 'eval' to execute; and use of 'eval' in
shell on arbitrary file names is generally not worth the added danger.

Why are you even bothering with ls, when the following is faster and
does what you want, without having to worry about awkward quoting in the
first place?

cat *.pdf

> 
> How do I get around this problem?

Your problem has nothing to do with coreutils, and everything to do with
shell quoting.  You may want to take this question to a forum dedicated
to proper shell usage.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to