I prefer to use tmux rather than the default linux virtual console (i.e. what
agetty uses), so I put this in
~/.bashrc so that tmux runs automatically when I log in to a TTY:
if [[ "$(tty)" == /dev/tty* ]]; then tmux -u fi
At first it seems like this works: tmux runs as soon as I login. However, when I exit tmux, tmux immediately runs a second time! Here is the complete behavior:
- Log in
- Default prompt briefly visible before tmux runs
- I'm in
- The text
[exited]briefly flashes, and then I'm back in
- Back in default terminal without
- Now I'm completely logged out
I can't track this down - I've tried logging all sorts of things, setting environment variables, looking at
$SHLVL. It actually looks like
.bashrc gets run like 7 times each time I log in!
I don't normally use tmux from within X (I just use Konsole), but I tried setting bashrc to have tmux run for all non-tmux sessions, and this double behavior did not happen in Konsole.
- Arch Linux (4.8.13-1)
~/.bashrcand other configs (no
~/.bash_profilefile): https://gist.github.com/tobek/c8038c207f318528c3157b4a402aa2d9 (I tried removing bashish stuff, but behavior remained)
What on could be causing this?