不要将当前的bash会话保存到历史记录 [英] Don't save current bash session to history

查看:71
本文介绍了不要将当前的bash会话保存到历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到在打开.bash_history时,它仅包含上一个会话中的条目,似乎当前会话仅在退出时附加.有什么方法可以防止当前会话保存?如果知道如何执行,甚至崩溃bash也是一种选择.我发现我可以kill -9该过程,但是如果有更好的方法,我想知道.

I notice that when opening .bash_history that it contains only the entries from my previous session, it seems that the current session is appended only on exit. Is there any way to prevent the current session from saving? Even crashing bash is an option if one knows how to do that. I found that I can kill -9 the process, but if there is a better way I would love to know.

推荐答案

使用history -c命令清除当前会话的历史记录可能比使bash崩溃更为优雅.然后,没有什么可保存的(它甚至可以从历史记录中擦除自身).

Perhaps more elegant than crashing bash would be to use the history -c command to clear the history of the current session. Then, there's nothing to save (it even wipes itself from the history).

这篇关于不要将当前的bash会话保存到历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆