虽然我的HISTFILESIZE和HISTSIZE大于500,但在我进入"norc“外壳后,bash历史就被销毁了。如何通过各种shell类型保存历史数据?
下面是一个实际的例子。
// on the normal shell (bash)
/mnt/c/pg$ wc ~/.bash_history
876 1997 19855 /home/user/.bash_history
/mnt/c/pg$ logout
PS > bash --noprofile --norc
// on the norc shell
bash-4.4$ wc ~/.bash_history
847 1947 19406 /home/user/.bash_history
// -> notice that .bash_history is trimmed to the default 500 lines. This is the problem.
bash-4.4$ exit
// again on the normal shell
PS > bash
/mnt/c/pg$ wc ~/.bash_history
848 1948 19439 /home/user/.bash_history
// -> once I enter to a norc shell, it affects the entire shell experiences这是我的.bashrc和.profile的一部分
// .bashrc
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
// .. // .profile
export HISTCONTROL=ignoredups:erasedups # no duplicate entries
export HISTSIZE=100000 # big big history
export HISTFILESIZE=100000 # big big history
shopt -s histappend # append to history, don't overwrite it
// .. 发布于 2022-12-16 04:22:29
使用空的HISTFILE运行它,所以shell不会尝试更新默认文件:
HISTFILE= bash --noprofile --norchttps://askubuntu.com/questions/1445324
复制相似问题