dont keep backups by default
authorIan Kelling <ian@iankelling.org>
Fri, 28 Oct 2016 06:13:15 +0000 (23:13 -0700)
committerIan Kelling <ian@iankelling.org>
Fri, 28 Oct 2016 06:13:15 +0000 (23:13 -0700)
cedit

diff --git a/cedit b/cedit
index e6d128d291ad58af7c630dd5f52e151586937859..9d37b55e56bc1053527489f86c8c4673420361ca 100755 (executable)
--- a/cedit
+++ b/cedit
@@ -25,13 +25,16 @@ section. Without SECTION_NAME, it acts on a global unnamed
 section. cedit is short for config edit.
 
 -v         Verbose
+-b         Keep backup file
 -h|--help  Help"
     local s diff name init
     local file_dir="$(dirname "$file")"
     local exists=true
     local verbose=false
+    local backup=false
 
     case $1 in
+        -b) backup=true; shift ;;
         -v) verbose=true; shift ;;
         -h|--help) echo "$help"; return ;;
     esac
@@ -116,6 +119,9 @@ section. cedit is short for config edit.
             echo "$diff"
         fi
     fi
+    if ! $backup; then
+        rm -r $"$temp"
+    fi
     return $ret
 }
 cedit "$@"