sshrm/sshrm
2023-12-06 00:39:04 +01:00

16 lines
330 B
Bash
Executable File

#!/bin/bash
declare -r FILENAME="${HOME}/.ssh/known_hosts"
declare HOST=""
if [ ! "${1}" == "" ]; then
case "${1}" in
*[!0-9]*) HOST=${1} ;;
*) HOST=$(sed -n -e ${1}p "${FILENAME}" | awk '{print $1}') ;;
esac
ssh-keygen -R "${HOST}"
else
echo "Error: No host or line number provided !"
echo "sshrm host|line_number"
fi