Last active
April 23, 2016 07:19
-
-
Save OrangeCrush/a7cd16e1bf82e67f2a12 to your computer and use it in GitHub Desktop.
Create multiple tmux panes with a SERVER variable
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 | |
# | |
# I like to run this like | |
# cat serverfile | xargs ./panes.sh name-of-pane | |
# | |
NAME=$1 | |
shift | |
if [ $# == 0 ] | |
then | |
echo "You need to provide hostnames as arguments" | |
exit 127 | |
fi | |
tmux new-session -d -s $NAME | |
tmux send-keys "SERVER=$1" | |
shift | |
for PANE in $@ | |
do | |
tmux split-window -h | |
tmux send-keys "SERVER=${PANE}" | |
tmux select-layout tiled | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment