2016-11-14 15:05:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
export SSH_AUTH_SOCK="${HOME}/.ssh/ssh_auth_sock"
|
2017-06-12 13:43:17 +03:00
|
|
|
cmd="$1"
|
2016-11-14 15:05:26 +02:00
|
|
|
shift
|
2016-11-17 14:14:47 +02:00
|
|
|
get_hosts() {
|
|
|
|
awk -F",| " '{print $1}' "${HOME}/.ssh/known_hosts"
|
2016-12-06 11:03:04 +02:00
|
|
|
awk '$1 == "Host" {print $2}' "${HOME}/.ssh/config"
|
2016-11-17 14:14:47 +02:00
|
|
|
}
|
2016-12-06 11:03:04 +02:00
|
|
|
result=$(get_hosts | sort -uV | dmenu -p ssh ${1+"$@"}) || exit 1
|
2016-11-14 15:05:26 +02:00
|
|
|
exec $cmd $result
|
|
|
|
|
|
|
|
# call from ~/.i3/config:
|
|
|
|
# bindsym $mod+Control+Return exec ~/bin/dmenu_ssh '/usr/bin/urxvtc -e ssh' -i -b -fn "$font"
|