diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-30 18:34:32 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2012-09-30 18:34:32 +0200 |
commit | 8681d2000b756955f6f1a25601e0c3128691cb5c (patch) | |
tree | 8db5269a99435cc29ca1a412be16b0473672f415 | |
parent | 3b16d1d3fbd221724378475085a1170997d732b5 (diff) |
Check error code of gpg before copying to clipboard.
-rwxr-xr-x | src/password-store.sh | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/password-store.sh b/src/password-store.sh index e4e622e..4a04fbe 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -223,7 +223,9 @@ case "$command" in if [[ $clip -eq 0 ]]; then exec gpg2 -d $GPG_OPTS "$passfile" else - clip "$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" "$path" + pass="$(gpg2 -d $GPG_OPTS "$passfile" | head -n 1)" + [[ -n $pass ]] || exit 1 + clip "$pass" "$path" fi fi ;; |