bug-bash
[Top][All Lists]
Advanced

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

Re: Bash =~ regex doesn't work in 3.2.25 as in 3.1.17


From: 龙海涛
Subject: Re: Bash =~ regex doesn't work in 3.2.25 as in 3.1.17
Date: Wed, 21 Nov 2007 14:49:30 +0800

try not to use the quote... [[ "$*" =~ .* ]]

it seems the behiavor changed between 3.1.* and 3.2.*

from the NEWS file:
" Quoting the string argument to the [[ command's  =~ operator now
forces string matching, as with the other pattern-matching operators."

somebody posted here before.


On Tue, 2007-11-20 at 23:40 -0600, Terry Raitt wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i386
> OS: freebsd5.3
> Compiler: cc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
> -DCONF_OSTYPE='freebsd5.3' -DCONF_MACHTYPE='i386-portbld-freebsd5.3' 
> -DCONF_VENDOR='portbld' -DLOCALEDIR='/usr/local/share/locale' 
> -DPACKAGE='bash' -DSHELL  -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  
> -I/usr/local/include -O -pipe
> uname output: FreeBSD zeus.layeredtech.com 5.3-RELEASE FreeBSD 5.3-RELEASE 
> #0: Fri Nov  5 04:19:18 UTC 2004     
> address@hidden:/usr/obj/usr/src/sys/GENERIC  i386
> Machine Type: i386-portbld-freebsd5.3
> 
> Bash Version: 3.2
> Patch Level: 25
> Release Status: release
> 
> Description:
>       Bash =~ regex does not work as it did in bash 3.1.17
> 
> Repeat-By:
> # cat test.bashregex.sh 
> #!/usr/local/bin/bash 
> 
> bash --version 
> echo ; 
> 
> 
> if [[ "$*" =~ ".*" ]]; 
> then 
>         echo "The =~ regex works!"; 
> else 
>         echo "The =~ regex fails!"; 
> fi 
> 
> 
> # cp -p /usr/local/bin/bash3.1.17 /usr/local/bin/bash 
> # ./test.bashregex.sh hello 
> GNU bash, version 3.1.17(0)-release (i386-portbld-freebsd6.2) 
> Copyright (C) 2005 Free Software Foundation, Inc. 
> 
> 
> The =~ regex works! 
> 
> 
> # cp -p /usr/local/bin/bash3.2.25 /usr/local/bin/bash 
> # ./test.bashregex.sh hello 
> GNU bash, version 3.2.25(0)-release (i386-portbld-freebsd5.3) 
> Copyright (C) 2005 Free Software Foundation, Inc. 
> 
> 
> The =~ regex fails! 
> 
> 
>       [Describe the sequence of events that causes the problem
>       to occur.]
> 
> Fix:
>       [Description of how to fix the problem.  If you don't know a
>       fix for the problem, don't include this section.]
> 
> 





reply via email to

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