#!/bin/sh #apikey=SECRET #secretapikey=SECRET uri=https://porkbun.com/api/json/v3/ssl/retrieve/ get_cert() { domain=$1 curl "$uri/$domain" --silent --data "{ \"apikey\": \"$apikey\", \"secretapikey\": \"$secretapikey\" }" } extract_keys() { jq --raw-output .publickey,.privatekey } for domain in 53hor.net theglassyladies.com do get_cert $domain | extract_keys > $domain.pem done