On Wed, Jun 12, 2013 at 6:53 PM, Linda Walsh <b...@tlinx.org> wrote:
> The trace looks aprolike this: > >> ./ifc#137(handle_bonding_ops)> (( 18>3 )) >>> ./ifc#138(handle_bonding_ops)> [[ mode=balance-rr 0 =~ >>> >> >> ^([a-zA-Z][-a-zA-Z0-9_]+)=(.+)**[[:space:]]+[a-zA-Z][-a-zA-Z0-**9_]+=.+.*$ > ]] > >> ./ifc#142(handle_bonding_ops)> [[ mode=balance-rr 0 =~ >>> ^([a-zA-Z][-a-zA-Z0-9_]+)=(.+)**$ ]] >>> ./ifc#145(handle_bonding_ops)> break >>> >> > (#138 is all 1 line) > ---- the source code looks like this: > > my id='[a-zA-Z][-a-zA-Z0-9_]+' > while ((${#bond_ops}>3)); do > if [[ $bond_ops =~ ^($id)=(.+)[[:space:]]+$id=.+.***$ ]]; then > ... > elif [[ "$bond_ops" =~ ^($id)=(.+)$ ]]; then > ... > else break; fi > > --- > I would think the 2nd match would match it, but no luck... > Note the 2nd source line has double quotes due to testing... > Originally it had no quotes, as I don't believe they are > necessary in this case. Regardless, neither way matches. > > So if not obvious, bond_ops has "mode=balance-rr 0" in it. > > Thanks... > > > Just FYI, you should be using [[:alpha:]] and [[:alnum:]], as they're safe for all locales. You can't count on a-z or A-Z unless the locale is C or POSIX. And no, quotes on the LHS of [[ are not needed, as wordsplitting and pathname expansion do not occur within the [[ keyword.