Last active
May 29, 2016 17:28
-
-
Save faejr/fa688df3bbcec00ad56a0dd1ab4ac4b8 to your computer and use it in GitHub Desktop.
Restores or create a new tmux development environment (4 panes)
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/bash | |
SESSIONS=$(tmux ls) | |
RESTORED=false | |
IFS=':' read -ra SES <<< "$SESSIONS" | |
if [ ${#SES} != 0 ]; then | |
for i in "${SES[@]}"; do | |
if [ "$i" = "dev" ]; then | |
RESTORED=true | |
tmux a -t "$i" | |
fi | |
done | |
fi | |
if [ "$RESTORED" = false ]; then | |
tmux new-session -s 'dev' -d | |
tmux split-window -h | |
tmux split-window -v | |
tmux select-pane -t 0 | |
tmux split-window -v | |
tmux select-pane -t 0 | |
tmux new-window 'dev' | |
tmux -2 attach-session -d | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment