bug-bash
[Top][All Lists]
Advanced

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

Re: Bug in ${PARAMETER//PATTERN/STRING} with extglob and Pattern *(PAT


From: Chet Ramey
Subject: Re: Bug in ${PARAMETER//PATTERN/STRING} with extglob and Pattern *(PATTERN-LIST)
Date: Thu, 16 Nov 2000 15:44:09 -0500

> Bash Version: 2.04
> Patch Level: 0
> Release Status: release
>  =
> 
> Description:
> I tried to do things one normally uses awk for. But I need this string
> manipulations on a boot-floppy, where not enough space is left for a
> statically linked awk.
>  =
> 
> I just want to strip   *([[:alpha:]]|[:/]) =

No, you don't.  This will strip everything (remember, the `*' matches 0 or
more).  And, as you discovered, it exposes some really bad behavior in the
bash pattern matcher, so it will strip it slowwwwwwwwly.

> echo $temp
> /dev/hda: 3907008 /dev/hdb: 9903600 /dev/sda: 2202244 total: 16012852
> blocks
>  =
> 
> echo ${temp//*([[:alpha:]])}

Try this instead:

echo ${temp//+([[:alpha:]:\/])/}

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet)

Chet Ramey, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

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