Created
October 13, 2013 08:09
-
-
Save zx1986/6959687 to your computer and use it in GitHub Desktop.
tmux auto script
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 | |
tmux new-session -d -s sites | |
tmux new-window -t sites:0 -n 'irc' '/usr/bin/irssi' | |
tmux new-window -t sites:1 -n 'w1' 'ssh w1.example.com' | |
tmux new-window -t sites:2 -n 'w2' 'ssh w2.example.com' | |
tmux select-window -t sites:1 | |
tmux -2 attach-session -t sites | |
### | |
if [[ $SSH_CONNECTION != "" && $MY_SSH_CONNECTION != "yes" ]]; then | |
while true; do | |
echo -n "Do you want to attach to a tmux session? [y/n]" | |
read yn | |
case $yn in | |
[Yy]* ) MY_SSH_CONNECTION="yes" tmux attach; break;; | |
[Nn]* ) break;; | |
* ) echo "Please answer y/n";; | |
esac | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment