coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: process the output of $() with files with spaces


From: Pádraig Brady
Subject: Re: process the output of $() with files with spaces
Date: Mon, 19 Aug 2013 20:06:04 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 08/19/2013 07:54 PM, Eric Blake wrote:
> 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

http://www.pixelbeat.org/programming/shell_script_mistakes.html#globbing




reply via email to

[Prev in Thread] Current Thread [Next in Thread]