From ae43b3a5972cae3364aec5e419c73a62b7d40b01 Mon Sep 17 00:00:00 2001 From: Von Random Date: Thu, 17 Nov 2016 15:14:47 +0300 Subject: [PATCH] dmenu ssh update to include stuff from ssh config --- dmenu_ssh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dmenu_ssh b/dmenu_ssh index 9f3e2ae..000b431 100755 --- a/dmenu_ssh +++ b/dmenu_ssh @@ -3,7 +3,11 @@ export SSH_AUTH_SOCK="${HOME}/.ssh/ssh_auth_sock" cmd=$1 shift -result=$(sed "s/[, ].*//" ~/.ssh/known_hosts | sort -u | dmenu -p ssh ${1+"$@"}) || exit 1 +get_hosts() { + awk -F",| " '{print $1}' "${HOME}/.ssh/known_hosts" + awk '{if ($1 == "Host") print $2}' "${HOME}/.ssh/config" +} +result=$(get_hosts | sort -u | dmenu -p ssh ${1+"$@"}) || exit 1 exec $cmd $result # call from ~/.i3/config: