Skip to content

Instantly share code, notes, and snippets.

@hoegaarden
Last active June 29, 2018 17:53
Show Gist options
  • Save hoegaarden/0411b6f5d73bffc318a6137143cc9337 to your computer and use it in GitHub Desktop.
Save hoegaarden/0411b6f5d73bffc318a6137143cc9337 to your computer and use it in GitHub Desktop.
I want to always run tumx
#!/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