Here i using the code for increment MAC address of last bit after increment last bit overflow so to over come again recount from starting eg: last position is FF then after we increment by 1 we start count by 00 ----------------
#!/bin/sh mac=$(ifconfig eth0|grep HWaddr|awk '{print $5}'| tr '[a-z]' '[A-Z]' | + cut -d ':' -f1-5) maclast=$(ifconfig eth0|grep HWaddr|awk '{print $5}'| tr '[a-z]' '[A-Z +]' | cut -d ':' -f6) echo "Mac address= $mac:$maclast" decmac=$(echo "ibase=16; $maclast"|bc) if [ $decmac -eq '241' ] then macinc='00' else incout=`expr $decmac + 1 ` macinc=$(echo "obase=16; $incout"|bc) fi echo "Mac address= $mac:$macinc"
OUTPUT:
Mac address= 00:19:D1:F6:F7:F1 Mac address= 00:19:D1:F6:F7:00

In reply to Re^2: How to increment a MAC Address? by Anonymous Monk
in thread How to increment a MAC Address? by imperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.