【问题标题】:How to execute a command in bash without logging to history? [duplicate]如何在 bash 中执行命令而不记录到历史记录? [复制]
【发布时间】:2020-02-22 21:00:00
【问题描述】:

我已经看到在没有将其记录在历史记录之前运行带有空格的命令(至少是命令) 但这似乎不是 PopOS 的情况

它在 Ubuntu 中有效,但在 PopOS 中无效。 有什么解决方法或其他技巧我可以尝试

$ls
$history
 1 ls
 2 history
$ pwd #there's a space preceding this command
$history
 1 ls
 2 history
 3 pwd
 4 history

在 Ubuntu 中有效,但在 POPOS 中无效

【问题讨论】:

标签: linux bash history


【解决方案1】:

为此使用设置:

 set +o history
    do your command you want to be ignored
 set -o history
    now your commands will be stored to history again

【讨论】:

    猜你喜欢
    • 2010-10-14
    • 2020-11-17
    • 2012-01-18
    • 2011-09-22
    • 1970-01-01
    • 1970-01-01
    • 2014-09-02
    • 2014-11-03
    • 2018-06-30
    相关资源
    最近更新 更多