Created
March 25, 2020 10:54
-
-
Save olive42/2dc758996e743f99321225913d7da440 to your computer and use it in GitHub Desktop.
Automatically attach to tmux session or create one if non-existent
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
# Add to ~/.zprofile - ZSH-specific? Not sure | |
tmux has -t scratch &> /dev/null | |
if [ $? != 0 ]; then | |
tmux -2 new-session -s scratch -D -d | |
fi | |
if [ -z $TMUX ]; then | |
tmux attach -t scratch -d | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment