Created
January 27, 2017 16:31
-
-
Save jhirbour/024d7d4995d52ecde8876f753f100be3 to your computer and use it in GitHub Desktop.
Create a Named Tmux session, named the same as the directory you're currently in.
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/sh | |
#PROJECT_NAME=`basename $PWD` | |
PROJECT_NAME=`basename $PWD | tr '.' '-'` | |
PROJECT_DIR=$PWD | |
tmux has-session -t $PROJECT_NAME 2>/dev/null | |
if [ "$?" -eq 1 ] ; then | |
echo "No Session found. Creating and configuring." | |
pushd $PROJECT_DIR | |
tmux new-session -d -s $PROJECT_NAME | |
tmux source-file ~/bin/tmux-${PROJECT_NAME}.conf | |
popd | |
else | |
echo "Session found. Connecting." | |
fi | |
tmux attach-session -t $PROJECT_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment