使用tmux丢失了我所有的bash别名,我怎么能让他们留下来?

Mic*_*ant 9 bash alias rvm tmux

我的.bashrc确实如此

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
Run Code Online (Sandbox Code Playgroud)

其中包括运行my .bash_aliases并给我一些我定义的别名.

但是,如果我尝试使用TMUX(调用tmux),我现在唯一的别名是:

$ aliasreturn # 将会呈现....

$ alias rvm-restart='rvm_reload_flag=1 source '\''/home/durrantm/.rvm/scripts/rvm'\'''
Run Code Online (Sandbox Code Playgroud)

我如何使用tmux仍然可以使用我的所有别名.

我在Ubuntu 12.04上

我的.bashrc文件的结尾如下所示:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# Automatic cd'ing
shopt -s autocd

if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion
fi

PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM

export EDITOR=vim

git config --global --add color.ui true
Run Code Online (Sandbox Code Playgroud)

tha*_*guy 17

tmux将您的shell作为登录shell调用.登录shell不会处理.bashrc,而是使用.bash_profile.

您可以简单地.bash_profile阅读.bashrc:

echo 'source ~/.bashrc' >> ~/.bash_profile
Run Code Online (Sandbox Code Playgroud)