Re: Wildcards in expanded variables
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 04/29/04
- Next message: Charles Demas: "Re: reading from conf file"
- Previous message: D. Alvarado: "Getting process error info"
- In reply to: Kevin Rodgers: "Re: Wildcards in expanded variables"
- Next in thread: Stephane CHAZELAS: "Re: Wildcards in expanded variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 11:54:25 -0400
In article <40911A83.9070004@yahoo.com>,
Kevin Rodgers <ihs_4664@yahoo.com> wrote:
> S?ren Hansen wrote:
> > findopts=""
> > for i in ${EXCEPTIONS}
> > do
> > findopts="${findopts} ! -path '${i}*'"
> > done
> >
> > But when that is expanded, the apostrophes are treated as literals,
> > not as delimiters.
>
> What do you mean? Doesn't
>
> echo $findopts
>
> print
>
> ! -path '/proc*' ! -path '/dev*' ! -path '/sys*' ! -path '/var/lib/mysql*' !
> -path '/var/lock*'
And since you can see the quotes there, they're being treated as
literals. As a result, it will match a file in a subdirectory named "'"
whose name begins with "proc" and ends with "'".
The solution then is to use eval:
eval find "$findopts"
This will cause the quotes to be re-processed.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Next message: Charles Demas: "Re: reading from conf file"
- Previous message: D. Alvarado: "Getting process error info"
- In reply to: Kevin Rodgers: "Re: Wildcards in expanded variables"
- Next in thread: Stephane CHAZELAS: "Re: Wildcards in expanded variables"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|