From 3955cb4678948013fc7e871574f7eef7cc556c99 Mon Sep 17 00:00:00 2001 From: Brian Mattern Date: Wed, 12 Sep 2012 22:24:20 -0700 Subject: prevent 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 to add GNU readline features by using -e in read. --- src/password-store.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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" -- cgit v1.2.3-54-g00ecf