tmux as a login shell; why, really?
Update: As a buddy on IRC pointed out, the tmux manpage mentions in the
description to the -c
option that it will default tio the default shell when
not applied. But that still doesn’t explain why anyone would want this. I also
do not seem to be the only one, after looking around I found a many scripts
trying to mitigate the problem I described, for example this
gist,
where we find /usr/bin/tmux attach || /usr/bin/tmux new
in line 34…
So I just inspected my /etc/shells
for really no apparent reason, and I
found that /usr/bin/tmux
is listed as a valid login shell. Wat. I mean…
isn’t that kind of breaking tmux’ semantics? Also, what shell will tmux use
when it’s the login shell? Itself? Manpage doesn’t say anything and I do not
seem to have a systemwide tmux.conf
and even if so, I couldn’t find any
indication what it’s gonna use…
So I created a testuser and set tmux
as it’s default shell. OK. After
logging in I actually get a real interactive shell (and not a tmux-inception):
$ echo $SHELL
/bin/sh
OK, I kind of expected that. But now here is the thing. Since tmux as a login
shell is started up with nop parameters, it will always spawn a new tmux
instance, even if a detached session exist. I tried it, and I was able to
switch from the new tmux session to the old one by using (
or )
, but when
I end the previous session, I am logged out with the other session detached.
So I wonder… what is the whole point about this? It is so nonsensical. It is counter-intuitive and I do not see any point here…