in f13 =~ no longer working in bash

Richard W.M. Jones rjones at redhat.com
Tue Jun 8 19:05:07 UTC 2010


On Tue, Jun 08, 2010 at 02:14:12PM +0200, Farkas Levente wrote:
> hi,
> =~ no longer working in bash. just try this little line:
> -----------------------------
> if [[ "abc" =~ "abc.*" ]]; then echo inside; else echo outside; fi
> -----------------------------
> this give "inside" up to fedora-12, but it gives
> "outside" in fedora-13.
> imho it's a serious changes since all shell script will fail which use
> =~ :-(
> is there any reason for this? or any quick fixes?

This bit us in libguestfs too, where we'd used the bash extension
without thinking that they'd break it on us.

The full fix is *not* just quote removal.

cf. our first fix:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=457fccae1b665347f81045e8c7a3309d8328c4fc

and out later, complete fix:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=4891ff9945177e8666af8381d1e0a54b8ce363e2

Huge pain in the neck .. bash should retain backwards compatibility,
even for non-POSIX extensions.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


More information about the devel mailing list