bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug report: extended pattern match bug (or "feature" [sic] / inconsi


From: Chet Ramey
Subject: Re: Bug report: extended pattern match bug (or "feature" [sic] / inconsistency)
Date: Thu, 25 Mar 2004 08:32:45 -0500

> I have a file in a directory:
> 
>     3ddiag-0.703-176.i586.rpm
> 
> I am attempting to set a variable to the name of this file while not
> matching other varients of the name.
> 
> I decided to use the pattern (correct or not):
> 
>     $a-+([-0-9.a-z])$b)
> 
> "a" and "b" are set:
> 
>     a=3ddiag
>     b=i586.rpm
> 
> So to set a variable "cur" (indicating current version in current 
> directory), I used:
> 
>     cur=$a-+([-0-9.a-z])$b
> 
> However, in the above context, the regular expression for the path is 
> not evaluated.
> What I get is:
> 
>     echo "$cur"

Make sure you have the `extglob' option set and unquote the expansion.
Quotes inhibit pathname expansion.

You can see this by running:

x=*
echo "$x"
echo $x

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    chet@po.cwru.edu    http://tiswww.tis.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]