[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash-3.2 Official Patch 10
From: |
Tim Waugh |
Subject: |
Re: Bash-3.2 Official Patch 10 |
Date: |
Tue, 06 Mar 2007 10:55:01 +0000 |
On Mon, 2007-03-05 at 17:49 -0500, Chet Ramey wrote:
> The glibc implementation of regcomp/regexec does not allow backslashes to
> escape "ordinary" pattern characters when matching. Bash used backslashes
> to quote all characters when the pattern argument to the [[ special
> command's =~ operator was quoted. This caused the match to fail on Linux
> and other systems using GNU libc.
There still doesn't seem to be a way to write expressions that work in
3.2 and in 3.1. For example, below is an expression that works fine in
3.1. How do I re-write it so that it (a) continues to work with
bash-3.1, and (b) also works with bash-3.2?
{ cat "$file" ; echo ; } | while read line; do
if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
/sbin/ip rule del $line
fi
done
In particular, when the whole thing is de-quoted bash-3.1 seems to
require the parentheses to be escaped, while bash-3.2 seems to require
that they are *not* escaped.
Tim.
*/
signature.asc
Description: This is a digitally signed message part