From 5b32da0412bf995b162cb42cefc5a5a392bdb009 Mon Sep 17 00:00:00 2001 From: Jameson Rollins Date: Fri, 29 Oct 2010 22:07:53 -0400 Subject: [PATCH] catch return for grep in remove_line, for case where grep -v returns nothing (e.g. only line in file is removed) --- src/share/common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/common b/src/share/common index 025c991..1e393c7 100644 --- a/src/share/common +++ b/src/share/common @@ -346,7 +346,7 @@ remove_line() { log debug "removing matching key lines..." tempfile=$(mktemp "${file}.XXXXXXX") || \ failure "Unable to make temp file '${file}.XXXXXXX'" - grep -v -x -F "$lines" "$file" >"$tempfile" + grep -v -x -F "$lines" "$file" >"$tempfile" || : mv -f "$tempfile" "$file" fi } -- 2.26.2