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: Bill Gradwohl
Subject: Re: Why is command substitution happening?
Date: Tue, 12 Apr 2011 09:26:05 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Thunderbird/3.1.9

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

>If a filename contains something like $(...) or `...` then
> yes, bash would perform a command substitution.
> 
> 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 this simple find
won't work unless I run it as many times as there is depth to the hierarchy.

BTW - Is there a better place to ask these questions about bash? I doubt
this is a bug so asking here is probably inappropriate, but I don't know
where else to ask.

- -- 
Bill Gradwohl
Roatan, Honduras
504 9 899 2652
IM:address@hidden (No email please-IM only)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk2kbw0ACgkQ7Orvev+eC8rAawCfVhZUwVzLrTvJmZNovtPXmNKp
M7sAoITB6mbUpH/wyck0AGc+Y9G9+YBe
=NpXm
-----END PGP SIGNATURE-----



reply via email to

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