mirror of
https://github.com/anatolykopyl/sshukh.git
synced 2026-03-26 04:45:04 +00:00
Fixed the prompt
This commit is contained in:
@@ -1,12 +1,27 @@
|
||||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# User will be prompted if they want to update known_hosts if ssh errors out
|
||||
# with "Host key verification failed."
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Anatoly <akopyl@radner.ru>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
sshukh () {
|
||||
output=$(ssh "$@")
|
||||
output=$(\ssh "$@")
|
||||
if [ $? -eq 255 ];
|
||||
then
|
||||
host=$(cut -d'@' -f2 <<< $1)
|
||||
while true; do
|
||||
read -p "Update known_hosts? [y/n] " yn
|
||||
read yn"?Update known_hosts? [y/n] "
|
||||
case $yn in
|
||||
[Yy]* ) ssh-keygen -R $host && ssh "$@"; break;;
|
||||
[Yy]* ) ssh-keygen -R $host && \ssh "$@"; break;;
|
||||
[Nn]* ) exit;;
|
||||
* ) echo "Please answer y or n.";;
|
||||
esac
|
||||
|
||||
Reference in New Issue
Block a user