[PATCH] Keep existing file extension for edit command

Jason A. Donenfeld Jason at zx2c4.com
Wed Sep 5 08:04:22 CEST 2018


What about:

diff --git a/src/password-store.sh b/src/password-store.sh
index d89d455..4a05c7f 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -474,7 +474,9 @@ cmd_edit() {
  set_git "$passfile"

  tmpdir #Defines $SECURE_TMPDIR
- local tmp_file="$(mktemp -u "$SECURE_TMPDIR/XXXXXX")-${path//\//-}.txt"
+ local extension
+ [[ $path == *.* ]] || extension=".txt"
+ local tmp_file="$(mktemp -u
"$SECURE_TMPDIR/XXXXXX")-${path//\//-}${extension}"

  local action="Add"
  if [[ -f $passfile ]]; then


Would that meet the requirements?


More information about the Password-Store mailing list