from commands import getstatusoutput as getso
def excuteShell(cmd):
print("excute shell command: ", cmd)
status, result = getso(cmd)
if status == 0:
print("cmd[%s] done:[%s]" % (cmd, result))
else:
print("cmd[%s] failed:[%s]" % (cmd, result))
return status, result
excuteShell("ls -l") # 参数为linux命令