<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hello,<br>
    <br>
    in STABLE release of grml I found a bug reproducable with GNU awk
    3.1.7 and 3.1.8. There is this code:<br>
    <br>
          awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}<br>
            /address/{if(found){address=$NF}}<br>
            /netmask/{if(found){netmask=$NF}}<br>
            /broadcast/{if(found){broadcast=$NF}}<br>
            /gateway/{if(found){gateway=$NF}}<br>
            /dns-nameservers/{if(found){dns-nameservers=$NF}}<br>
            END{print address" "netmask" "broadcast" "gateway"
    "dns-nameservers}' /etc/network/interfaces >"$TMP"<br>
    <br>
    But when it is executed it fails with:<br>
    awk: cmd. line:5:        
    /dns-nameservers/{if(found){dns-nameservers=$NF}}<br>
    awk: cmd. line:5:                                                   
    ^ syntax error<br>
    <br>
    The reason I believe is that character "-" is not allowed in
    variable name in awk. When replacing the code with following, it
    works correctly:<br>
    <br>
          awk '/iface/{if(/'"$DV"'/){found=1}else{found=0}}<br>
            /address/{if(found){address=$NF}}<br>
            /netmask/{if(found){netmask=$NF}}<br>
            /broadcast/{if(found){broadcast=$NF}}<br>
            /gateway/{if(found){gateway=$NF}}<br>
            /dns-nameservers/{if(found){dnsnameservers=$NF}}<br>
            END{print address" "netmask" "broadcast" "gateway"
    "dnsnameservers}' /etc/network/interfaces >"$TMP"<br>
    <br>
    Regards,<br>
    Marek<br>
    <div class="moz-signature">-- <br>
      <br>
      <b>Marek Malevič</b><br>
      <a href="http://www.malevic.cz">www.malevic.cz</a><br>
      +420 608 116 896</div>
  </body>
</html>