From 73660b09adc61b84f3f9de7186f3ae56a4775126 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 31 Jan 2011 08:42:46 +0100 Subject: [PATCH] add script: remove_line (by number) Signed-off-by: Nico Schottelius --- remove_line | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 remove_line diff --git a/remove_line b/remove_line new file mode 100755 index 0000000..d4d2aef --- /dev/null +++ b/remove_line @@ -0,0 +1,47 @@ +#!/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 . +# +# +# 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: " + exit 1 +fi + +file="$1"; shift +line="$1"; shift + +ex -c "${line}d|w|q" "${file}"