Changing tmux .bash_profile behavior
tmux sets an environment variable called $TMUX
, which I believe holds the location of the socket it's using. Either way you can use it in your .bash_profile
to test whether or not it is being called from within tmux.
if [ -z "$TMUX" ]; then
# not in tmux, do non-tmux things
fi
Or
if [ -n "$TMUX" ]; then
# called inside tmux session, do tmux things
fi
I usually use $TERM
to test that. screen
and tmux
set it to "screen" by default.