<b>Tip:</b>: IIRC, the <code>ip</code> command is replacing the <code>ifconfig</code> command.  In this case, I think the equivalent would be <code>ip -4 -o link list</code> which is much easier to parse in code also.