[Top][All Lists]

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

Re: bash 3.2 match operator problem

From: John Gatewood Ham
Subject: Re: bash 3.2 match operator problem
Date: Thu, 12 Oct 2006 22:16:33 +0700 (ICT)

Thank you for your reply.

I removed the quotes and the script crashes.  There must be more
required to convert my code and I hope someone will help.  It is
only 1 line, and once I know the new rules I can convert everything
else on my own.  I get this when just removing teh quotes on the
right hand side:

testcase running under 3.2.0(2)-release
testcase: line 6: unexpected argument `(' to conditional binary operator
testcase: line 6: syntax error near `(['
testcase: line 6: `[[ "${OLDCANDIDATE}" =~ 
([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz ]]'

I had several responses that said "just remove the quotes" but I don't
think any of them removed the quotes themselves and tried running the
supplied test case.  Did the supplied test case (after removing those
quotes) work for you with bash 3.2 ?  Work means print 'Life is good'.


On Thu, 12 Oct 2006, Chet Ramey wrote:

Machine Type: i586-pc-linux-gnu

Bash Version: 3.2
Patch Level: 0
Release Status: release

  I just upgraded to bash 3.2 and my scripts quit working for matching.
The test case below will say 'Life is good' in bash 3.1.17, but on bash
3.2 I get 'Upgrade of doom returns 2 from match' instead.
[[ "${OLDCANDIDATE}" =~ "([^-]+)-([^-]+)-([^-]+)-0*([1-9][0-9]*)\.tgz" ]]

This is from the list of new features in bash-3.2:

f.  Quoting the string argument to the [[ command's  =~ operator now forces
   string matching, as with the other pattern-matching operators.

The change was made for consistency -- without it, there is no way to have
the string matched without regard to characters significant to the matcher.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                                Live Strong.
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.case.edu/~chet/

reply via email to

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