Created
November 27, 2012 13:37
-
-
Save diabloneo/4154259 to your computer and use it in GitHub Desktop.
Starting tmux with specific windows
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 | |
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