From 358880697ed27da7ef926060347a9c4013b1d487 Mon Sep 17 00:00:00 2001 From: Anatoly Kopyl Date: Sat, 3 Apr 2021 15:17:27 +0300 Subject: [PATCH] Initial commit --- sshukh.plugin.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 sshukh.plugin.zsh diff --git a/sshukh.plugin.zsh b/sshukh.plugin.zsh new file mode 100755 index 0000000..1455f81 --- /dev/null +++ b/sshukh.plugin.zsh @@ -0,0 +1,14 @@ +#!/bin/sh +output=$(ssh "$@") +if [ $? -eq 255 ]; +then + host=$(cut -d'@' -f2 <<< $1) + while true; do + read -p "Update known_hosts? [y/n] " yn + case $yn in + [Yy]* ) ssh-keygen -R $host && ssh "$@"; break;; + [Nn]* ) exit;; + * ) echo "Please answer y or n.";; + esac + done +fi