in f13 =~ no longer working in bash

Ville Skyttä ville.skytta at iki.fi
Wed Jun 9 06:02:43 UTC 2010


On Tuesday 08 June 2010, Richard W.M. Jones wrote:

> The full fix is *not* just quote removal.
> 
> cf. our first fix:
> http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=457fccae1b665347f81
> 045e8c7a3309d8328c4fc
> 
> and out later, complete fix:
> http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=4891ff9945177e8666a
> f8381d1e0a54b8ce363e2
> 
> Huge pain in the neck ..

FWIW these issues can sometimes (often?) be fixed by not using =~ at all, 
either by using simple or extended (shopt -s extglob) globbing.  A couple of 
examples from the above:

-    elif [[ "$path" =~ '^\./lib/modules/' ]]; then
+    elif [[ "$path" == ./lib/modules/* ]]; then

-    elif [[ "$file" =~ '^ld-[.0-9]+\.so$' ]]; then
+    elif [[ "$file" == ld-+([.0-9]).so ]]; then

-    elif [[ "$file" =~ '^libbfd-.*\.so$' ]]; then
+    elif [[ "$file" == libbfd-*.so ]]; then


More information about the devel mailing list