bug-bash
[Top][All Lists]
Advanced

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

Re: Why is command substitution happening?


From: Greg Wooledge
Subject: Re: Why is command substitution happening?
Date: Tue, 12 Apr 2011 11:33:29 -0400
User-agent: Mutt/1.4.2.3i

On Tue, Apr 12, 2011 at 09:15:40AM -0600, Bill Gradwohl wrote:
> What I did notice were path names that contained single quotes as
> follows scattered throughout the stream:
> 
> rmdir --ignore-fail-on-non-empty "/snapshot/Music/ZZ Top/ZZ Top - ZZ
> Top's First Album -1970"
> 
> I also noticed path names containing single backquotes as in:
> 
> rmdir --ignore-fail-on-non-empty "/snapshot/Music/Elton John/1999 -
> Elton John And Tim Rice`s Aida"
> 
> Could this somehow be the cause?

Yes.  Bash is trying to parse all of the lines of input you are feeding
it.  Your attempt is doomed.


On Tue, Apr 12, 2011 at 09:26:05AM -0600, Bill Gradwohl wrote:
> On 04/12/2011 08:03 AM, Greg Wooledge wrote:
> 
> > Not good.  You're piping filenames into bash and letting bash parse them
> > as commands.  
> Not exactly. I'm passing in commands containing file names.

You are passing a stream of bytes.  This stream of bytes contains a
mixture of bytes that YOU chose, and bytes that come from unpredictable
filenames.  It's very, very bad.

> > Just do this instead:
> > 
> >   find . -type d -exec rmdir {} \; 2>/dev/null
> 
> That find would process directories at the top of the hierarchy first. I
> need to process the hierarchy in the reverse order,

So use -depth.



reply via email to

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