On Sat, Nov 06, 2010 at 03:09:08AM +0100, Hans-Georg Bork wrote: > $ prog='find /test -type d ! -wholename "/test"' > $ echo $prog > find /test -type d ! -wholename "/test" > $ echo "$($prog)" > /test > /test/c > /test/b > /test/d > /test/a > $
This is an error in your script, not in bash. You're passing literal double-quotes as part of an argument to find. find is therefore looking for files that have double-quotes in their name. If you wanted those double-quotes to be interpreted by bash, you would have to use eval. Of course, your double-quotes are not actually necessary in this example. Chances are you've obfuscated the original code.... What you're attempting *appears* to fall into this category: http://mywiki.wooledge.org/BashFAQ/050 -- I'm trying to put a command in a variable, but the complex cases always fail! I'd suggest reading that (and avoiding eval).