Last active
June 29, 2018 17:53
-
-
Save hoegaarden/0411b6f5d73bffc318a6137143cc9337 to your computer and use it in GitHub Desktop.
I want to always run tumx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
_() { | |
test -e "${HOME}/.bash-no-tmux" && return | |
command -v tmux >/dev/null || return | |
test -z "$SSH_CONNECTION" || return | |
[[ ! $TERM =~ screen && -z $TMUX ]] || return | |
local session="term-$$" | |
local noCloseFile="/dev/shm/.${session}-no-close" | |
tmux new -s "$session" | |
while tmux attach -t "$session" >/dev/null 2>&1 ; do : ; done | |
if [ -e "$noCloseFile" ] | |
then | |
rm -f -- "$noCloseFile" | |
else | |
exit | |
fi | |
} && _ | |
# ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment