#!/usr/bin/env bash declare -a KEYSERVERS=( pgp.mit.edu keyring.debian.org keyserver.ubuntu.com ); for keyid in $(gpg --list-key --keyid-format=0xshort | grep sub | awk '{ print $2 }' | cut -d/ -f2); do echo "# Publishing key: ${keyid}" for server in ${KEYSERVERS[*]}; do if gpg --keyserver "${server}" --send-keys "${keyid}"; then echo -e "\033[1;38;5;154mgpg --keyserver \033[1;38;5;208m${server} \033[1;38;5;154m--send-keys \033[1;38;5;220m${keyid}\033[0m" fi done echo done