nsbin/remove_line

48 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
#
# 2011 Nico Schottelius (nico-nsbin at schottelius.org)
#
# This file is part of nsbin.
#
# nsbin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# nsbin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with nsbin. If not, see <http://www.gnu.org/licenses/>.
#
#
# Helpful for ssh / known_hosts problem:
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
# Someone could be eavesdropping on you right now (man-in-the-middle attack)!
# It is also possible that the RSA host key has just been changed.
# The fingerprint for the RSA key sent by the remote host is
# e0:53:cf:55:ea:ae:06:b1:20:27:f4:ce:29:f4:fb:b4.
# Please contact your system administrator.
# Add correct host key in /home/users/nico/.ssh/known_hosts to get rid of this message.
# Offending key in /home/users/nico/.ssh/known_hosts:381
#
# Use remove_line: remove_line ~/.ssh/known_hosts 381
################################################################################
if [ $# -ne 2 ]; then
echo "$0: <file> <line>"
exit 1
fi
file="$1"; shift
line="$1"; shift
ex -c "${line}d|w|q" "${file}"