Tim Waugh wrote: > 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.
The easiest thing to do is probably to assign the regular expression to a variable. You may need to conditionally assign it based on the value of $BASH_VERSION, but probably not. This would have worked before and after any patches or changes to bash-3.2. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer Live Strong. No day but today. Chet Ramey, ITS, CWRU [EMAIL PROTECTED] http://cnswww.cns.cwru.edu/~chet/ _______________________________________________ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash