mirror of
https://github.com/anatolykopyl/sshukh.git
synced 2026-03-26 12:55:02 +00:00
Turned everything ito a function
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
#!/bin/sh
|
sshukh () {
|
||||||
output=$(ssh "$@")
|
output=$(ssh "$@")
|
||||||
if [ $? -eq 255 ];
|
if [ $? -eq 255 ];
|
||||||
then
|
then
|
||||||
host=$(cut -d'@' -f2 <<< $1)
|
host=$(cut -d'@' -f2 <<< $1)
|
||||||
while true; do
|
while true; do
|
||||||
read -p "Update known_hosts? [y/n] " yn
|
read -p "Update known_hosts? [y/n] " yn
|
||||||
case $yn in
|
case $yn in
|
||||||
[Yy]* ) ssh-keygen -R $host && ssh "$@"; break;;
|
[Yy]* ) ssh-keygen -R $host && ssh "$@"; break;;
|
||||||
[Nn]* ) exit;;
|
[Nn]* ) exit;;
|
||||||
* ) echo "Please answer y or n.";;
|
* ) echo "Please answer y or n.";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user