diff options
author | Brian Mattern <rephorm@rephorm.com> | 2012-09-12 22:24:20 -0700 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-13 07:51:40 +0200 |
commit | 3955cb4678948013fc7e871574f7eef7cc556c99 (patch) | |
tree | ee34ac46dcd318c18b123edf2abfff258770d616 /src | |
parent | 9fe3cb21e1193ede695bc790a5c476b009aef895 (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.
Diffstat (limited to 'src')
-rwxr-xr-x | src/password-store.sh | 4 |
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" |