From e8674920643c2faac8170e5bcf2f656f69212612 Mon Sep 17 00:00:00 2001 From: William Melody Date: Mon, 16 Mar 2015 17:51:28 -0700 Subject: [PATCH] In `remove`, delete the link in place rather than blanking first When using the pattern of blanking the lines first and then deleting the blank lines, the program ends up deleting potentially intentional blank lines. In order to avoid this, use a simple delete rather than the blanking + blank line deleting pattern. --- hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts b/hosts index b9b9af1..7408cef 100755 --- a/hosts +++ b/hosts @@ -690,7 +690,7 @@ remove() { $_me help remove exit 1 else - sed -i "s/^[^#].*[^A-Za-z0-9\.]${hostname}$//g;/^$/d" /etc/hosts + sed -i "/^[^#].*[^A-Za-z0-9\.]${hostname}$/d" /etc/hosts fi }