m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Mattern <rephorm@rephorm.com>2012-09-12 22:24:20 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2012-09-13 07:51:40 +0200
commit3955cb4678948013fc7e871574f7eef7cc556c99 (patch)
treeee34ac46dcd318c18b123edf2abfff258770d616
parent9fe3cb21e1193ede695bc790a5c476b009aef895 (diff)
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.
-rwxr-xr-xsrc/password-store.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index c8a0a9f..6771ab2 100755
--- 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"