scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

smenu.sh (362B)


      1 #!/bin/sh
      2 
      3 # Parses ~/.ssh/{config,known_hosts}. Fzf[0] takes over for fuzzy selection and
      4 # passes argument to xargs.
      5 
      6 set -A complete_ssh $(
      7 	(awk '!/\*/ && /^Host /{print $2}' ~/.ssh/config;
      8 	# awk '{sub(",.*$","",$1);print $1}' ~/.ssh/known_hosts
      9 	)|sort -u
     10 )
     11 
     12 printf "%s\n" "${complete_ssh[@]}" | fzf | xargs -o ssh
     13 
     14 
     15 # [0]: https://github.com/junegunn/fzf