From 61d0250fd9eb21eef23aaa6dffa7513a5d5d8bd5 Mon Sep 17 00:00:00 2001 From: MatMoul Date: Wed, 6 Dec 2023 00:22:00 +0100 Subject: [PATCH] Add code --- sshrm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 sshrm diff --git a/sshrm b/sshrm new file mode 100755 index 0000000..20feff3 --- /dev/null +++ b/sshrm @@ -0,0 +1,14 @@ +#!/bin/bash + +declare -r FILENAME="${HOME}/.ssh/known_hosts" +declare HOST="" + +if [ ! "${1}" == "" ]; then + case ${1} in + *[!0-9]*) HOST=$(sed -n -e "${1}"p "${FILENAME}" | awk '{print $1}') ;; + *) HOST=${1} ;; + esac + ssh-keygen -R "${HOST}" +else + echo "Error: No IP or line number provided !" +fi