![](/img/trans.png)
[英]How to change the desktop wallpaper on linux from within a shell/bash script
[英]how to clear history of shell that a bash script executed from it in linux?
我在 Linux 中有一个 bash 脚本,我想清除我的脚本从它执行的 shell 的历史记录。
我知道history -c
清除当前 session 历史记录,但我想清除父 session 历史记录。
我的脚本是这样的:
#!/bin/bash
# my code
history -c
cat /dev/null > ~/.bash_history
但它不起作用!
我怎样才能做到这一点?
我尝试了这个并且它有效,但是在重新切换到root用户之后:
su - root -c "history -c"
su - root -c "cat /dev/null > ~/.bash_history"
history -c
cat /dev/null > ~/.bash_history
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.