mirror of
https://gitea.blesmrt.net/mikaela/shell-things.git
synced 2025-01-22 10:04:34 +01:00
bashrc: Start tmux always when bash starts, not only on SSH login.
This commit is contained in:
parent
f9b06f8893
commit
9054697bdb
9
bashrc
9
bashrc
@ -119,11 +119,8 @@ source ~/.bash_private_aliases
|
|||||||
# To see time when bash starts :)
|
# To see time when bash starts :)
|
||||||
date
|
date
|
||||||
|
|
||||||
# To use tmux as "login shell" when you login with SSH. When you run logout, the connection is closed automatically and when you detach, the connection closes. (Copied from http://william.shallum.net/random-notes/automatically-start-tmux-on-ssh-login )
|
# Starts tmux always on start of bash, not only on SSH login, and quits from bash when tmux quits. WARNING: I DON'T KNOW WHAT HAPPENS IF YOU DON'T HAVE TMUX INSTALLED!
|
||||||
if [ "$PS1" != "" -a "${STARTED_TMUX:-x}" = x -a "${SSH_TTY:-x}" != x ]
|
if [[ $TERM != "screen" ]]
|
||||||
then
|
then
|
||||||
STARTED_TMUX=1; export STARTED_TMUX
|
tmux has-session -t 0 && tmux attach-session -t 0 || tmux new-session -s 0 && exit
|
||||||
sleep 1
|
|
||||||
( (tmux has-session -t remote && tmux attach-session -t remote) || (tmux new-session -s remote) ) && exit 0
|
|
||||||
echo "tmux failed to start"
|
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user