projects
/
monkeysphere.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2072a06
)
fix remove_line function to not use fixed string checking, and to mv -f the tmp file...
author
Jameson Rollins
<jrollins@finestructure.net>
Tue, 19 Oct 2010 04:00:17 +0000
(
00:00
-0400)
committer
Jameson Rollins
<jrollins@finestructure.net>
Tue, 19 Oct 2010 04:00:17 +0000
(
00:00
-0400)
src/share/common
patch
|
blob
|
history
diff --git
a/src/share/common
b/src/share/common
index 8c21a836f5dbb270a84fba00de0c8eb134f0def1..d286145f31481f9b5bf806466979f4e08cdd073e 100644
(file)
--- a/
src/share/common
+++ b/
src/share/common
@@
-340,14
+340,13
@@
remove_line() {
fi
# if the string is in the file...
- if grep
-q -F "$string" "$file" 2
>/dev/null ; then
+ if grep
"$string" "$file" &
>/dev/null ; then
tempfile=$(mktemp "${file}.XXXXXXX") || \
failure "Unable to make temp file '${file}.XXXXXXX'"
# remove the line with the string, and return 0
- grep -v -F "$string" "$file" >"$tempfile"
- cat "$tempfile" > "$file"
- rm "$tempfile"
+ grep -v "$string" "$file" >"$tempfile"
+ mv -f "$tempfile" "$file"
return 0
# otherwise return 1
else