Parsing json in shell? Easy! filter="$(printf 's/. \[%s\][[:space:]] \([^"]*\)/\\1/p' "$(json_path "${1:-}" "${2:-}")")" Please, no! How can you know this is safe? Why not just use Python? It is installed pretty much everywhere, supports json without such hacks.
In my experience Python software is not really nice when it comes to distribution. Hate the venv stuff and pip install hassles. Besides, it is slow. Honestly, if runtime interpretation is a requirement, PHP would be better then in these respects.
#!/bin/sh
set -eu
set -o pipefail
cd /home/letsencrypt
openssl verify -CAfile lets-encrypt-x3-cross-signed.pem -attime `date -d 'next month' '+%s'` mah_domain.crt | grep expired || exit 0
DT=`date "+%Y%m%d"`
python3 acme-tiny/acme_tiny.py --account-key account.key --csr mah_domain.csr --acme-dir /srv/www/mah_domain/htdocs/.well-known/acme-challenge/ > signed_${DT}.crt
curl -sO https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.p...
cat signed_${DT}.crt lets-encrypt-x3-cross-signed.pem > mah_domain_chained_${DT}.pem
mv mah_domain_chained_${DT}.pem mah_domain_chained.pem
mv signed_${DT}.crt mah_domain.crt
set +e
nginx -c /srv/nginx/conf/nginx.conf -s reload