dotfiles/.bin/OLD/dexec_ssh.bak
2024-02-14 07:55:58 +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