Re: Wildcards in expanded variables

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 04/29/04


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 ***


Relevant Pages

  • Re: How to force apostrophe?
    ... I type words that begin with apostrophes, ... Works on my Powebook G4 - and have "curly quotes enabled" ... I have used autocorrect and the character palette to solve similar ...
    (microsoft.public.mac.office.word)
  • Re: Each Night I Dream of Home: my review
    ... apostrophes show up fine, but about a quarter of them show as question ... The problem is in allowing so-called "smart quotes" which are not in the ... Composing a message in Microsoft Word (in the ... basic ASCII characters can be trusted. ...
    (rec.arts.sf.tv.babylon5.moderated)
  • Re: Word 2004 inserting spaces after quotes/apostrophes in Arial
    ... I've changed the typeface from Arial to ... another sans serif that kerns properly with quotes and apostrophes. ...
    (microsoft.public.mac.office.word)
  • Re: sendmail not recognizing some email addresses
    ... of quotes is not a valid email address and I should ... Double quotes are used for quoting, ... Apostrophes are *not* used ... Apostrophes are illegal in the host part of the actual address, ...
    (comp.mail.sendmail)
  • Re: Keyboard Setting in FC2
    ... Jorge Fábregas wrote: ... >>I have selected U.S. English as my keyboard type, ... my apostrophes and quotes don't work properly ...
    (Fedora)