Skip to content

Instantly share code, notes, and snippets.

@usaturn
Created June 3, 2014 08:31
Show Gist options
  • Save usaturn/61135e4a96ca4cc3f48a to your computer and use it in GitHub Desktop.
Save usaturn/61135e4a96ca4cc3f48a to your computer and use it in GitHub Desktop.
ssh-keygen -R がメンドくさい
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