bug-bash
[Top][All Lists]
Advanced

[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:48:19 +0700 (ICT)

Ok, here is a smaller 3 line test case.  I have attempted to handle
the parenthesis as you instructed.  Under bash 3.0.17 BASH_REMATCH
gets the 4 pieces.  Under bash 3.2 I only get BASH_REMATCH=()
True, it no longer crashes.  But it doesn't work either...

#!/bin/bash
[[ jbig2dec-0.9-i586-001.tgz =~ 
\([^-]+\)-\([^-]+\)-\([^-]+\)-0*\([1-9][0-9]*\)\.tgz ]]
set | grep BASH_REMATCH

On Thu, 12 Oct 2006, Andreas Schwab wrote:

John Gatewood Ham <zappaman@buraphalinux.org> writes:

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 the 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 ]]'

Parens are special inside [[ ]], you need to quote them.

Andreas.




reply via email to

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