我的 .bashrc 可以
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
其中包括运行我的 .bash_aliases
并为我提供了大量我定义的别名。
但是,如果我尝试使用 TMUX(通过 tmux
调用),我现在拥有的唯一别名是:
$ alias
return # 将显示....
$ alias rvm-restart='rvm_reload_flag=1 source '\''/home/durrantm/.rvm/scripts/rvm'\'''
我怎样才能使用 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
最佳答案
tmux 调用您的 shell 作为登录 shell。登录 shell 不处理 .bashrc
,而是使用 .bash_profile
。
您可以简单地让 .bash_profile
读取您的 .bashrc
:
echo 'source ~/.bashrc' >> ~/.bash_profile
关于bash - 使用 tmux 会丢失我所有的 bash 别名,我怎样才能让它们保留下来?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16223748/