bash: Variable expansion in comand substitution
- From: rayvd@xxxxxxxxxxxx
- Date: Thu, 28 Jun 2007 19:27:34 -0000
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!
.
- Follow-Ups:
- Re: bash: Variable expansion in comand substitution
- From: Stephane CHAZELAS
- Re: bash: Variable expansion in comand substitution
- Prev by Date: Re: Redirect STDOUT and STDERR to file in ksh
- Next by Date: Re: bash: Variable expansion in comand substitution
- Previous by thread: Redirect STDOUT and STDERR to file in ksh
- Next by thread: Re: bash: Variable expansion in comand substitution
- Index(es):
Relevant Pages
|
Loading