Skip to content

Instantly share code, notes, and snippets.

@ecthiender
Created March 27, 2013 12:28
Show Gist options
  • Save ecthiender/5253810 to your computer and use it in GitHub Desktop.
Save ecthiender/5253810 to your computer and use it in GitHub Desktop.
Tmux session initiation script: creates a new tmux session or attaches to an existing one.
#!/bin/sh
# tmux session initialisation script
# change the following config to your preferences
SESSION="work"
workspace1="$HOME/server/www"
workspace2="$HOME/codeyard"
tmux has-session -t $SESSION > /dev/null
if [[ $? -eq 0 ]]
then
echo "Session exists\n"
tmux attach-session -t $SESSION
exit 0;
fi
echo "Creating new session $SESSION\n"
cd $workspace1
tmux new-session -d -s $SESSION -n www-dev
cd $workspace2
tmux new-window -t $SESSION:2 -n codeyard
tmux select-window -t $SESSION:1
tmux attach-session -t $SESSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment