#!/usr/bin/env python
import pexpect
child = pexpect.spawn('/bin/bash -c "ls -l > logs.txt"')
child.expect(pexpect.EOF) #匹配数据的最后,表示数据传输完成
#!/usr/bin/env python
import pexpect
shell_cmd='ls -l>logs1.txt'
child = pexpect.spawn('/bin/bash',['-c',shell_cmd])
child.expect(pexpect.EOF)


