From e8620944aca253db14b44a62ae167ad86565ae79 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 6 Aug 2015 13:35:07 +0200 Subject: Tighten gpg calls with --with-colons option. --- localgpgcleankeyring | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'localgpgcleankeyring') diff --git a/localgpgcleankeyring b/localgpgcleankeyring index 0662135..0be9c67 100755 --- a/localgpgcleankeyring +++ b/localgpgcleankeyring @@ -4,7 +4,7 @@ # origin: https://scruss.com/blog/2013/05/12/clean-up-your-gnupg-keyring/ # my key should probably be the first secret key listed -mykey=$(gpg --list-secret-keys | grep '^sec' | cut -c 13-20 | head -1) +mykey=$(gpg --list-secret-keys --with-colons | grep '^sec' | cut -d: -f5 | head -1) if [ -z $mykey ] then @@ -14,7 +14,7 @@ then fi # all of the people who have signed my key -mysigners=$(gpg --list-sigs $mykey | grep '^sig' | cut -c 14-21 | sort -u) +mysigners=$(gpg --list-sigs --with-colons $mykey | grep '^sig' | cut -d: -f5 | sort -u) # keep all of the signers, plus my key (if I haven't self-signed) keepers=$(echo $mykey $mysigners | tr ' ' '\012' | sort -u) @@ -26,7 +26,7 @@ keepers_egrep=$(echo $keepers | sed 's/^/^(/; s/$/)/; s/ /|/g;') echo '# Keepers: ' $keepers # everyone who isn't on the keepers list is deleted -deleters=$(gpg --list-keys | grep '^pub'| cut -c 13-20 | egrep -v ${keepers_egrep}) +deleters=$(gpg --list-keys --with-colons | grep '^pub' | cut -d: -f5 | egrep -v ${keepers_egrep}) # echo the command if there are any to delete # command is interactive -- cgit v1.2.3