Skip to content

Instantly share code, notes, and snippets.

@OrangeCrush
Last active April 23, 2016 07:19
Show Gist options
  • Save OrangeCrush/a7cd16e1bf82e67f2a12 to your computer and use it in GitHub Desktop.
Save OrangeCrush/a7cd16e1bf82e67f2a12 to your computer and use it in GitHub Desktop.
Create multiple tmux panes with a SERVER variable
#!/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