如何运行tmsh (f5)命令并使用SSH python获得输出?
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('1.1.1.1', username='username', password='password')
ssh.exec_command('ls') //Working
# how to execute tmsh command using ssh ?
ssh.exec_command('tmsh show /sys CPU') // ??? 发布于 2020-05-21 13:55:45
在解决这个问题的过程中,我得到了解决这个问题的方法:
stdin, stdout, stderr = ssh.exec_command("tmsh show /sys CPU | cat")
print stdout.read()使用此命令,我可以获得tmsh输出。如果没有grep,它将在stdout.read()中返回空白输出。
https://stackoverflow.com/questions/61927173
复制相似问题