#!/bin/bash
echo ">>> Generating GPG <<<"
gpg --full-generate-key;
ID=$(gpg --list-secret-keys --keyid-format LONG | perl -n -e'/^sec.*\/(\w*)\s+/ && print $1')
echo ">>> ID: $ID <<<"
echo ">>> Exporting public key <<<"
gpg --armor --export $ID