Created
June 3, 2014 08:31
-
-
Save usaturn/61135e4a96ca4cc3f48a to your computer and use it in GitHub Desktop.
ssh-keygen -R がメンドくさい
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rmkey(){ | |
TARGET_HOST=$1 | |
if [ -z "$TARGET_HOST" ]; then | |
echo "must hostname or ipaddr" | |
return 1 | |
fi | |
if [[ $TARGET_HOST =~ [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]]; then | |
ssh-keygen -R $TARGET_HOST | |
elif [[ $TARGET_HOST =~ [a-zA-Z0-9]{3,20} ]]; then | |
ssh-keygen -R $TARGET_HOST | |
else | |
echo "Fales" | |
fi | |
return 0 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment