3
0

getSecret 406 B

123456789101112
  1. #!/bin/bash
  2. PATH="/usr/local/bin:${PATH}"
  3. # get Email Secret ID :
  4. last_id=$( ovhcli get me/notification/email/history | jq 'last(.[])' )
  5. secret_id=$( ovhcli get "me/notification/email/history/${last_id}" | jq -r '.body' | awk '/secret/ { split($NF,a,"=") ; print a[2] }' )
  6. # retrieve or set Password from email link
  7. ovhcli post secret/retrieve '{ "id": "'"${secret_id}"'" }' | jq -r '.secret'
  8. exit $?