[pass] [PATCH] reencrypt_path: use --with-colons with gpg

schalox schalox at gmail.com
Sun Apr 20 22:01:46 CEST 2014


- gpg's output is now colon-separated
---
Could 'sort | uniq' be replaced with 'sort -u'?

 src/password-store.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/password-store.sh b/src/password-store.sh
index bf76708..0b8c971 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -102,7 +102,7 @@ reencrypt_path() {
 
 		set_gpg_recipients "$passfile_dir"
 		[[ $prev_gpg_recipients != "${GPG_RECIPIENTS[@]}" ]] &&
-		gpg_keys="$($GPG --list-keys --keyid-format long "${GPG_RECIPIENTS[@]}" | sed -n 's/sub *.*\/\([A-F0-9]\{16\}\) .*/\1/p' | sort | uniq)"
+		gpg_keys="$($GPG --list-keys --with-colons "${GPG_RECIPIENTS[@]}" | grep '^sub:' | cut -d ':' -f 5 | sort | uniq)"
 		current_keys="$($GPG -v --list-only --keyid-format long "$passfile" 2>&1 | cut -d ' ' -f 5 | sort | uniq)"
 
 		if [[ $gpg_keys != "$current_keys" ]]; then
-- 
1.9.2



More information about the Password-Store mailing list