summaryrefslogtreecommitdiffstats
path: root/retiolum/bin/update_tinc_hosts
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-09 16:44:11 +0200
committertv <tv@xso>2011-09-09 16:44:11 +0200
commitbd44e393c7fcc5d2f92a99a2d6b52f1815ebdb84 (patch)
tree687e948eefa72dcd48d25d0151a04573db4b861d /retiolum/bin/update_tinc_hosts
parentb938d6ad54f1e78219559d74e3be6cbb3d949cf8 (diff)
//retiolum/bin/update_tinc_hosts: sed -i is evil, too
Diffstat (limited to 'retiolum/bin/update_tinc_hosts')
-rwxr-xr-xretiolum/bin/update_tinc_hosts5
1 files changed, 4 insertions, 1 deletions
diff --git a/retiolum/bin/update_tinc_hosts b/retiolum/bin/update_tinc_hosts
index fe0785e3..8cdc3beb 100755
--- a/retiolum/bin/update_tinc_hosts
+++ b/retiolum/bin/update_tinc_hosts
@@ -31,7 +31,10 @@ case "${*-I am made of stupid}" in
$0 has magic || $0 print magic >> $hosts < /dev/null
;;
('destroy magic')
- $0 has magic && sed -ie "/^$bs$/,/^$es$/d" $hosts
+ if $0 has magic; then
+ cache="`cat $hosts`"
+ echo "$cache" | sed "/^$bs$/,/^$es$/d" > $hosts
+ fi
;;
('has magic')
grep -q "^$bs$" $hosts && grep -q "^$es$" $hosts