-
Notifications
You must be signed in to change notification settings - Fork 9
/
jqUse.sh
executable file
·13 lines (11 loc) · 1001 Bytes
/
jqUse.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/bin/bash -xv
admin_email="[email protected]"
admin_password="xxx"
jsonStr='{ "auth": { "identity": { "methods": [ "password" ], "password": { "user": { "name": "$admin_email", "domain": { "name": "Default" }, "password": "$admin_password" } } }, "scope": { "project": {"domain": {"id": "default"}, "name": "guard" } } } }'
jq -c '.' <<<"$jsonStr"
#jq -c 'del(.key3)' <<<"$jsonStr"
#jq -c '.auth.identity.password.user.password = $newVal' --arg newVal "$admin_password" <<< "$jsonStr"
#jq -c '.auth.identity.password.user.password = $newVal' --arg newVal "$admin_password" <<< "$jsonStr"
#jq -c '.auth.identity.password.user.name = $newVal,.auth.identity.password.user.password = $newVal2' --arg newVal "$admin_email" --arg newVal2 "$admin_password"<<< "$jsonStr"
tmp=$(jq -c '.auth.identity.password.user.name = $admin_email' --arg admin_email "$admin_email" <<< "$jsonStr")
post_body=$(jq -c '.auth.identity.password.user.password = $admin_password' --arg admin_password "$admin_password" <<< "$tmp")