(Bash) SSH Into Host And Attach To Tmux Session

function sshtmuxattach {
  if [[ $# -ne 2 || -z "$1" || -z "$2" ]] ; then
      printf "Usage: ${FUNCNAME[0]} <Host> <Session>\n"
      printf "SSH into HOST and attach to Tmux SESSION.\n"
      return 1
  fi
  local host=$1;
  local session=$2
  ssh "$host" -t tmux attach -t "$session"
}

Leave a Reply

Your email address will not be published. Required fields are marked *