Skip to content

Instantly share code, notes, and snippets.

@zx1986
Created October 13, 2013 08:09
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 zx1986/6959687 to your computer and use it in GitHub Desktop.
Save zx1986/6959687 to your computer and use it in GitHub Desktop.
tmux auto script
#!/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