dotfiles/.bin/dexec_ssh
2022-12-06 08:01:44 +01:00

14 lines
394 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)
if [ ! -z "$HOST" ]; then
case "$HOST" in
*-sftp) texec "sftp $HOST"; ;;
*) texec "ssh $HOST"; ;;
esac
fi