commit 3955cb4678948013fc7e871574f7eef7cc556c99
parent 9fe3cb21e1193ede695bc790a5c476b009aef895
Author: Brian Mattern <rephorm@rephorm.com>
Date: Wed, 12 Sep 2012 22:24:20 -0700
prevent <ctrl-c> on password entry from wiping out file
Currently, if you hit ctrl-c at the standard 'Enter password' prompt,
since it is piped directly to gpg, the entry gets cleared. Trying to
read from that entry results in:
gpg: [don't know]: 1st length byte missing
This patch fixes this.
Tweaked by Jason A. Donenfeld <Jason@zx2c4.com> to add GNU readline
features by using -e in read.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/password-store.sh b/src/password-store.sh
@@ -212,8 +212,8 @@ case "$command" in
fi
done
else
- echo -n "Enter password for $path: "
- head -n 1 | gpg -q -e -r "$ID" -o "$passfile" --yes
+ read -p "Enter password for $path: " -e password
+ gpg -q -e -r "$ID" -o "$passfile" --yes <<<"$password"
fi
if [[ -d $GIT ]]; then
git add "$passfile"