Last active
March 30, 2017 12:43
-
-
Save matutter/565f91f7c46d074a63fab931833d1cf9 to your computer and use it in GitHub Desktop.
Automatically connect to tmux session
This file contains hidden or 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
| ## | |
| # Check for TMUX session, create or attach "remote" session if connected through | |
| # ssh or create or attach "local" session if connected through other means | |
| HOST_SESSION_NAME="local" | |
| SSH_SESSION_NAME="remote" | |
| SESSION_NAME=$HOST_SESSION_NAME | |
| if [ ! -n "$TMUX" ]; then | |
| if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then | |
| SESSION_NAME=$SSH_SESSION_NAME | |
| fi | |
| countDown "TMUX connecting to $SESSION_NAME session" 3 | |
| tmux attach-session -t $SESSION_NAME || tmux new-session -s $SESSION_NAME | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment