bash: Variable expansion in comand substitution



I have a simple script:

PART1="-type f"
PART2="-exec ls -l {} \;"
BOTH="$PART1 $PART2"

a=$(find $BOTH)

That doesn't quite work:

% sh -x ./test.sh
+ PART1='-type f'
+ PART2='-exec ls -l {} \;'
+ BOTH='-type f -exec ls -l {} \;'
++ find -type f -exec ls -l '{}' '\;'
find: missing argument to `-exec'
+ a=

I'm guessing find is mad about the single quotes surrounding {} and/or
\;

What I don't understand, is how those single quotes got there.

Any advice on how I would fix this? I just want to concatenate two
variables
together containing command line arguments and pass to find.

I have tried the initial variable assignment using single quotes
instead of
double, backslashing, etc, to no avail.

Thanks in advance!

.



Relevant Pages

  • Re: Using Multiple Combo Boxes on one Form
    ... Numbers require no delimiter. ... remove the single quotes. ... Syntax Error (Missing operator) in Expression. ... > Private Sub CboclSaleDate_AfterUpdate> ...
    (microsoft.public.access.forms)
  • Re: testing for "" blank nulls
    ... I'm guessing you mean on the DB side vs DataTable.Select. ... syntax is checking for '' (single quotes) or IS NULL (in access ISNULL ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Syntax error in Insert statement
    ... In your INSERT statement you are missing the VALUES keyword and you do ... not need the single quotes around the field name: ... I did get an error stating that NULL values were not allowed in column ...
    (microsoft.public.vb.database.ado)
  • Re: Syntax error in Insert statement
    ... In your INSERT statement you are missing the VALUES keyword and you do ... not need the single quotes around the field name: ... I did get an error stating that NULL values were not allowed in column ...
    (microsoft.public.vb.database.ado)
  • Re: How do I include a server tag within a javascript parameter which is itself within a HTML elemen
    ... At first glance it looks like you're missing some single quotes (or ... If that doesn't yeild any results, this is how I do these types of ... OnClientClick ='<%# String.format("return confirm('Are you certain you ...
    (microsoft.public.dotnet.framework.aspnet)

Loading