[Level 2] Get ether list by Python in Ubuntu.

#!/bin/env python
def getEtherList():
    return [x.strip() for x in \
    os.popen("ifconfig -a | \
    grep Link | grep '^[^ ]' | \
    grep -v lo | awk '{print($1)}'")\
    .readlines()]

print getEtherList()
Wish this helps.
regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 1] Rar tool for Solaris.

[Level 2] iif in Python