aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.local/bin/bashhistory7
1 files changed, 4 insertions, 3 deletions
diff --git a/.local/bin/bashhistory b/.local/bin/bashhistory
index 6320834..47eb762 100755
--- a/.local/bin/bashhistory
+++ b/.local/bin/bashhistory
@@ -11,9 +11,6 @@ _prune() {
sort --unique "$1" | sponge "$1" # Remove all duplicate entries.
}
-mkdir --parents "$directory"
-touch "$current"
-
_migrate() {
[ -f "$default" ] &&
cat "$default" >>"$persist" &&
@@ -23,9 +20,13 @@ _migrate() {
_store() {
cat "$current" >> "$persist" &&
+ cat "$current" >> "$persist.bak" &&
_prune "$persist" &&
true > "$current"
}
+mkdir --parents "$directory"
+touch "$current"
+
_migrate || true
_store