Skip to content

Instantly share code, notes, and snippets.

@anupdhml
Last active December 28, 2015 22:59
Show Gist options
  • Save anupdhml/7575963 to your computer and use it in GitHub Desktop.
Save anupdhml/7575963 to your computer and use it in GitHub Desktop.
Script to start tmux with all the necessary windows
#!/bin/bash
# Script to fire up tmux with all the important windows
# By anup
SESSION_NAME="coding"
# programs and directories
#cd ${HOME};
cmds="
vi $HOME/Desktop/tiltfactor/todo;
cd $HOME/public_html/tf/anup-mgame-nov/www/protected/;
cd $HOME/public_html/tf/anup-mgame-nov/www/protected/;
"
START_WINDOW=2
##############################################################################
if $(tmux has-session -t ${SESSION_NAME}); then
echo "Killing existing session..."
tmux kill-session -t ${SESSION_NAME}
fi
#tmux start-server
tmux new-session -d -s ${SESSION_NAME}
#cmd_arr=$(echo $cmds | tr ";" "\n")
IFS=';'
for cmd in $cmds; do
#echo "$cmd"
#tmux send-keys -t ${SESSION_NAME}:1 "$cmd" C-m
tmux new-window -t ${SESSION_NAME} "${cmd};bash -i"
done
tmux select-window -t ${SESSION_NAME}:${START_WINDOW}
tmux attach-session -d -t ${SESSION_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment