Skip to content

Instantly share code, notes, and snippets.

@WMcKibbin
Created August 12, 2019 15:07
Show Gist options
  • Save WMcKibbin/d72351d75e05a49c995859147bb73a0d to your computer and use it in GitHub Desktop.
Save WMcKibbin/d72351d75e05a49c995859147bb73a0d to your computer and use it in GitHub Desktop.

Revisions

  1. WMcKibbin created this gist Aug 12, 2019.
    18 changes: 18 additions & 0 deletions tmux-ssh.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash
    # Assume session is 0
    tmux attach-session -t 0
    WINDOW=$(tmux display-message -p "#I")
    FIRST_ARG=""

    for arg in $*; do
    if [[ $arg != *"%"* ]]; then
    if [[ $FIRST_ARG == "" ]]; then
    FIRST_ARG=$arg
    tmux send-keys "ssh $arg" Enter
    else
    tmux split-window "ssh $arg"
    fi
    tmux select-layout tiled
    fi
    done
    tmux set-window-option synchronize-panes on