【问题标题】:Call system command 'history' in Linux [duplicate]在 Linux 中调用系统命令“历史”[重复]
【发布时间】:2014-10-10 15:11:46
【问题描述】:

我正在尝试使用os.system 函数来调用命令“历史” 但标准输出只是显示'sh :1 history: not found'

其他示例,即 os.system('ls') 是有效的。谁能告诉我为什么“历史”不起作用,以及如何在 Python 脚本中调用“历史”命令。

【问题讨论】:

    标签: python linux


    【解决方案1】:

    history 不是可执行文件,而是内置的 bash 命令。你不能用os.system运行它。

    【讨论】:

      猜你喜欢
      • 2011-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-02
      • 2013-02-22
      • 2011-09-24
      • 2016-06-29
      相关资源
      最近更新 更多