Created
June 27, 2014 20:36
-
-
Save codekirei/af8310056137203b5e7b to your computer and use it in GitHub Desktop.
A simple shell script that determines if a specific named tmux session exists then attaches to it or creates it.
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
#!/bin/zsh | |
grepTest=$(tmux list-sessions | grep $1) | |
if [ ! $grepTest ]; then | |
tmux new -s $1 | |
else | |
tmux attach -t $1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For ease of use, I added this script to my
$PATH
and added the following line to.zshrc
:alias tma='tmux-hybrid-attach.sh $1'
Also, don't forget to make the script executable with
chmod +x
.