diff options
author | Toby Vincent <tobyv13@gmail.com> | 2022-09-16 12:19:12 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2022-09-16 12:19:12 -0500 |
commit | 7c5a4742466c2d3e7358a93224b2bd918b14eae8 (patch) | |
tree | e9fac1ce82c4d9f4d6a75b44befdf333472d3234 /tmux/.local/bin/tmux-ssh | |
parent | 37c2542e5da96b87f010009771d235e23305fdc2 (diff) |
feat(tmux): start work on ssh-based sessionizer
Diffstat (limited to 'tmux/.local/bin/tmux-ssh')
-rwxr-xr-x | tmux/.local/bin/tmux-ssh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tmux/.local/bin/tmux-ssh b/tmux/.local/bin/tmux-ssh new file mode 100755 index 0000000..2dedc53 --- /dev/null +++ b/tmux/.local/bin/tmux-ssh @@ -0,0 +1,18 @@ +#!/bin/sh + +setopt localoptions nonomatch +tmp="$(mktemp)" + +tail -n +1 ~/.ssh/config ~/.ssh/config.d/* /etc/ssh/ssh_config 2>/dev/null | grep -i '^\s*host ' | + awk '{for (i = 2; i <= NF; i++) print "ssh_config " $i}' | grep -v '[*?%]' >"$tmp" + +grep -oE '^[[a-z0-9.,:-]+' ~/.ssh/known_hosts | tr ',' '\n' | tr -d '[' | awk '{ print "known_hosts " $1 }' >"$tmp" +grep -v '^\s*\(#\|$\)' /etc/hosts | command grep -Fv '0.0.0.0' >"$tmp" +cat "$tmp" +exit 0 +while IFS= read -r host; do + hosts="$hosts $host" +done <"$tmp" +rm "$tmp" + +printf %s\\n "$hosts" | xargs -I{} -d ' ' printf %s\\n {} |