python使用paramiko执行top命令报错

出错脚本:

ssh.exec_command('top -n 1')

报错信息如下:
TERM environment variable not set

man top 中的 -b 选项的说明信息:

-b :Batch-mode operation

            Starts  top  in Batch mode, which could be useful for sending output from top to other programs or to a file.  In this mode, top will not accept input and runs until the iterations limit you've set with the `-n' command-line option or until killed.

不报错脚本:

ssh.exec_command('top -b -i -n 1')

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容