Created
July 8, 2018 14:20
-
-
Save madrzejewski/5787bde4579385b53b08724ce8d2ca16 to your computer and use it in GitHub Desktop.
Small script for https://blog.madrzejewski.com/traiter-json-shell-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Example for : https://blog.madrzejewski.com/traiter-json-shell-cli | |
set -euo pipefail | |
LC_ALL=C | |
OLD_IFS=$IFS | |
IFS=$'\n' | |
cpapi2 --output=json --user=mondev Email listpops | jq -c '.cpanelresult.data[] | {email: .email}' | while read json ; do | |
email=$(echo $json | jq -r .email) | |
echo "Envoi à $email" | |
echo "Contenu de mon message" | mail -s "Sujet" $email | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment