nixos-config/scripts/ssh-connect
2024-12-08 11:40:30 +03:00

13 lines
221 B
Bash
Executable file

#!/usr/bin/env bash
if [[ $# -eq 1 ]]; then
selected=$1
else
selected=$(grep -P "^Host ([^*]+)$" $HOME/.ssh/config | sed 's/Host //' | sort -r -f | fzf)
fi
if [[ -z $selected ]]; then
exit 0
fi
ssh $selected