#!/bin/zsh LOCATIONS=$(grep -ioE "ssh [a-z0-9]+@[a-z0-9]+\.[a-z0-9]+" $ZDOTDIR/.zsh_history | cut -c 5- | uniq) if [[ $1 =~ '^[0-9]+$' ]] ; then echo $(echo $LOCATIONS | tac | head -n $1) exit fi if [[ -z "$1" ]]; then LOCATION=$(echo $LOCATIONS | sort | uniq | fzf) else LOCATION=$1 fi ssh $LOCATION -t 'tmux new-session -A -s alpha'