Skip to content

Instantly share code, notes, and snippets.

@diabloneo
Created November 27, 2012 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diabloneo/4154259 to your computer and use it in GitHub Desktop.
Save diabloneo/4154259 to your computer and use it in GitHub Desktop.
Starting tmux with specific windows
#!/bin/bash
ROOTDIR=~/ruijie
SESSION=main
NONAME="bash"
window_list="tftp $NONAME ipython $NONAME"
tmux has-session -t $SESSION
if [ $? -eq 0 ]; then
echo "Session $SESSION already exists. Attacing."
tmux attach -t $SESSION
exit 0
fi
cd $ROOTDIR
tmux new-session -d -s $SESSION
tmux rename-window -t $SESSION:0 "minicom"
i=1
for eachwin in $window_list; do
if [ $eachwin = $NONAME ]; then
tmux new-window -t $SESSION:$i
else
tmux new-window -t $SESSION:$i -n $eachwin
fi
i=$((i+1))
done
tmux select-window -t $SESSION:0
tmux attach -t $SESSION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment