dotfiles/.bin/dexec_ssh
2024-01-21 12:06:39 +01:00

14 lines
400 B
Bash
Executable File

#!/bin/sh
. $HOME/.bin/_config
CONF=$(cat $HOME/.ssh/config| grep -Ei "^host" | grep -v '*' | cut -d" " -f2)
HOSTS=$(cat $HOME/.ssh/known_hosts | cut -d" " -f1 | tr ',' '\n')
HOST=$(printf '%s\n%s' "$CONF" "$HOSTS" | grep -v '=' | sort -ru | $DMENU_CMD -p SSH -l 20)
if [ ! -z "$HOST" ]; then
case "$HOST" in
*-sftp) texec "sftp $HOST"; ;;
*) texec "ssh $HOST"; ;;
esac
fi