On 01.05., Marcus MERIGHI wrote: > Hello, > > [email protected] (Okan Demirmen), 2019.04.29 (Mon) 16:19 (CEST): > > On Fri 2019.04.26 at 07:15 +0200, Bruno Fl?ckiger wrote: > > > Hi, > > > > > > The ssh menu of cwm(1) doesn't filter duplicated hostnames when reading > > > them from ~/.ssh/known_hosts. This patch makes sure each hostname is > > > only displayed once to the menu. > > > > Sure, maybe; but why again do we even have this inside a window manager? > > Really, the known_hosts parsing is incomplete at best; either the entire > > parsing code needs to be lifted from ssh or this (mis)feature should be > > removed from cwm. I prefer the latter. > > FWIW, i use "M-period" a lot... are there easy alternatives? > > Marcus >
I use dmenu[1] from suckless.org as a replacement. The following script reads the host names from ~/.ssh/known_hosts, feeds them to dmenu and executes ssh to the host I choose in an xterm: #!/bin/ksh expr="s/^@[a-z-]* //;s/[, ].*//;s/\[//;s/\]//" file=~/.ssh/known_hosts host=$(cat $file | sed "$expr" | sort | uniq | dmenu) [[ -n "$host" ]] && xterm -T "[ssh] $host" -e ssh $host I store the script in ~/bin/sshmenu.sh and add the following line to my ~/.cwmrc: bind-key M-period bin/sshmenu.sh Works like a charm for me. Cheers, Bruno [1] https://suckless.org/dmenu/
