getSecret 381 B

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