added dev and system scripts

This commit is contained in:
2015-06-15 18:00:58 -06:00
parent e8315d0324
commit 39f7f44ea5
2 changed files with 78 additions and 0 deletions
Executable
+41
View File
@@ -0,0 +1,41 @@
#!/bin/bash
######################################
# tmux start script for dev projects #
# author eric at ewpt3ch dot com #
######################################
# usage: dev.sh session
# check for a session
if [[ -z $1 ]]; then
echo -e "you need to name the session ie dev.sh \e[3msession"
exit
fi
session=$1
# check if we're in a tmux session, prevent nesting
if [[ "$TMUX" != "" ]]; then
echo -e "Error: cannot nest sessions \e[3meventualy want to detach and start new"
exit
fi
# check if session by session already exists
if (tmux has-session -t ${session} 2> /dev/null); then
echo -e "${session} already exists"
exit
fi
# not in a session not session already name session
# so lets create it
tmux new-session -d -s "${session}" -n "edit"
tmux split-window -v -p 20 -t "${session}"
tmux send-keys -t "${session}:1.1" "vim" C-m
tmux new-window -n "servers" -t "${session}"
tmux split-window -v -t "${session}:2"
tmux new-window -n "scratch" -t "${session}"
tmux send-keys -t "${session}:3.1" "git status" C-m
# finally attach to the new session
tmux attach-session -t "${session}"