Azure Cloud Shell历史logging在会话中持续存在

我的Azure Cloud Shell历史不会在会话中持续存在(10分钟后超时,所以这很烦人)。 .bashrc

 # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 

所以这应该工作,但没有.bash_history写入。

根据你的描述,看来你的shell环境variables设置不正确。 我testing我的Azure虚拟机,它适用于我。 我build议你可以检查下面的方法。

1.检查你当前的shell。

您可以使用echo $SHELL来获取当前的shell。 .bashrcconfiguration文件用于bash shell。 如果你使用其他的shell,比如csh,那么它不起作用。

2.检查.profile文件。 请确保以下命令是存在的。

 # if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi 

3.检查.profile.bashrc用户和组权限。

 -rw-r--r-- 1 shui shui 3771 Aug 31 2015 .bashrc 

更新:

云端Shell不会将历史命令保存到.bash_history 。 如果你想这样做。 您可以将export PROMPT_COMMAND='history -a'.bashrc 。 如贝沃:

 # append to the history file, don't overwrite it shopt -s histappend export PROMPT_COMMAND='history -a' 

那么你可以source .profile 。 现在,您可以find.bash_histroy并存储您的最新历史命令。

注:不build议这样做,因为其他人可以看到你的命令,这是不安全的行为。

截至目前,bash历史是在bash过程的成功退出时写出来的。 如果出现提前超时(现在增加到20分钟),则不会写出历史logging。 这是他们正在努力解决的一个错误。