Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3.  
  4. starttmux() {
  5.     if [ -z "$HOSTS" ]; then
  6.        echo -n "Please provide of list of hosts separated by spaces [ENTER]: "
  7.        read HOSTS
  8.     fi
  9.  
  10.     if [ -z "$PORT" ]; then
  11.        echo -n "Please provide port [ENTER]: "
  12.        read PORT
  13.     fi
  14.  
  15.     local hosts=( $HOSTS )
  16.  
  17.  
  18.     tmux new-window "ssh ${hosts[0]}"
  19.     #unset hosts[0];
  20.     for i in "${hosts[@]}"; do
  21.         tmux split-window -h "ssh $i -p $PORT"
  22.         tmux select-layout tiled > /dev/null
  23.     done
  24.     tmux select-pane -t 0
  25.     tmux set-window-option synchronize-panes on > /dev/null
  26.  
  27. }
  28.  
  29. HOSTS=${HOSTS:=$*}
  30.  
  31. starttmux
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement