【问题标题】:storing output of history command in a text file将历史命令的输出存储在文本文件中
【发布时间】:2012-04-20 02:53:55
【问题描述】:

我的脚本代码是

history > a.txt

但这不会在文本文件中存储任何内容。但是,当我在提示符中使用该命令时,它可以工作。

我正在 UNIX 上使用 KornShell (ksh) 脚本。

【问题讨论】:

    标签: shell unix scripting history ksh


    【解决方案1】:

    'history' 命令在命令行之外被禁用(就像你的脚本一样)。您可以使用以下方式启用它:

    set -o history

    现在“历史”命令将可用于您的脚本。

    【讨论】:

    • 它对我有用。你有没有运行“set -o history”并且成功了?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-12
    • 2014-05-11
    • 1970-01-01
    • 2019-10-07
    • 2018-07-29
    • 2014-08-11
    相关资源
    最近更新 更多