我根据网上教程把终端切换到 ZSH 后,想用回 Bash 。
于是切换回 Bash 后,点击键盘上就再也不能显示之前的操作历史记录了。
怎样做能恢复它的显示呢?
PS :在终端未退出前的历史纪录是能看到的,但是退出终端后再打开就看不到之前的历史纪录了。
谢谢~
1
kittyoung 2015-10-13 20:31:25 +08:00
set|grep his
|
2
gyzit OP @kittyoung
GuanYuzhesMBP:~ GuanYuzhe$ set|grep his HISTFILE=/Users/GuanYuzhe/.bash_sessions/8A86197D-6AEC-4434-AA70-287C19347466.historynew SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor SHELL_SESSION_HISTFILE=/Users/GuanYuzhe/.bash_sessions/8A86197D-6AEC-4434-AA70-287C19347466.history SHELL_SESSION_HISTFILE_NEW=/Users/GuanYuzhe/.bash_sessions/8A86197D-6AEC-4434-AA70-287C19347466.historynew SHELL_SESSION_HISTFILE_SHARED=/Users/GuanYuzhe/.bash_history shell_session_history_allowed () if shopt -q histappend; then shell_session_history_check () if shell_session_history_allowed; then shell_session_history_enable; if [ "$PROMPT_COMMAND" = "shell_session_history_check" ]; then if [[ $PROMPT_COMMAND =~ (.*)(; *shell_session_history_check *| *shell_session_history_check *; *)(.*) ]]; then shell_session_history_enable () shell_session_history_allowed && shell_session_save_history; shell_session_save_history () shell_session_history_enable; history -a; echo -ne '\n...copying shared history...'; echo -ne '\n...saving history...'; echo -n 'truncating history files...'; |
5
gyzit OP @kittyoung 可是还是不能退出终端后显示上次的历史纪录
按你说的运行了,之后运行 set|grep his 变成这个: GuanYuzhesMBP:~ GuanYuzhe$ set|grep his HISTFILE=/Users/GuanYuzhe/.bash_history SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor GuanYuzhesMBP:~ GuanYuzhe$ |
7
kittyoung 2015-10-13 21:05:52 +08:00
|
8
gyzit OP @kittyoung 是的没错,是运行过的命令的纪录。我朋友的机器在终端输入 exit 后,会有 saving session 的字样,我就是直接 logout 。
GuanYuzhesMBP:~ GuanYuzhe$ cat ~/.bash_history cat: /Users/GuanYuzhe/.bash_history: Permission denied GuanYuzhesMBP:~ GuanYuzhe$ sudo cat ~/.bash_history sh /Users/GuanYuzhe/Desktop/disable_activation_osx exit GuanYuzhesMBP:~ GuanYuzhe$ |