From a88e99bcf25757acce3139255c28f322aa146a7a Mon Sep 17 00:00:00 2001 From: Von Random Date: Tue, 6 Dec 2016 12:03:04 +0300 Subject: [PATCH] better awk syntax for ssh-config as well as better sorting for dmenu in dmenu_ssh --- dmenu_ssh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dmenu_ssh b/dmenu_ssh index 000b431..d38b6c8 100755 --- a/dmenu_ssh +++ b/dmenu_ssh @@ -5,9 +5,9 @@ cmd=$1 shift get_hosts() { awk -F",| " '{print $1}' "${HOME}/.ssh/known_hosts" - awk '{if ($1 == "Host") print $2}' "${HOME}/.ssh/config" + awk '$1 == "Host" {print $2}' "${HOME}/.ssh/config" } -result=$(get_hosts | sort -u | dmenu -p ssh ${1+"$@"}) || exit 1 +result=$(get_hosts | sort -uV | dmenu -p ssh ${1+"$@"}) || exit 1 exec $cmd $result # call from ~/.i3/config: