#!/usr/bin/env python

import subprocess

def print_config(str_cmd, eth):
	cmd = str_cmd + " " + eth
	print "output for:", cmd
	#p = subprocess.Popen([cmd,eth], stdout=subprocess.PIPE)
	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)

	output = p.communicate()[0]
	for line in output.splitlines():
		if (('inet' in line) or ('eth' in line)):
			print(line)

def print_net_config(eth):
	cmd = "ddsh -s net config " + eth
	print "output for:", cmd
	p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)

	output, err = p.communicate()
	for line in output.splitlines():
		if (('inet' in line) or ('eth' in line)):
			print(line)
def main():
	print_config('ddsh -s net config','eth0b')
	print_config('ifconfig','eth0b')

if __name__ == '__main__':
	main()


