nixos-config/scripts/ssh-connect

14 lines
221 B
Text
Raw Normal View History

2024-12-08 08:40:30 +00:00
#!/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