I want to take output of following command one variable and then want to get email id and id in two variables.
Code
curl -s -b ${COOKIE_FILE} -c ${COOKIE_FILE} 'https://api.xxxx.xxxx.com/sso/user?email='${USER_EMAIL} |python -m json.tool
Output
[
{
"createdAt": "2017-12-08T11:07:15.000Z",
"email": "[email protected]",
"gravatarUrl": "https://gravatar.com/avatar/13656",
"id": 937,
"updatedAt": "2017-12-08T11:07:15.000Z",
"username": "339cba4c-d90c-11e7-bc18-005056ba0d15"
}
]
one more, if USER_EMAIL is wrong then we get output as [] then I have to print Email ID is not present and I will exit code exit -1
I am python developer, doing scripting first time
jqinstead of regular unix tools like grep, sed, awk etc.-1would be an unusual exit code. Exit codes indicating failure are between 1 and 255 (see manual).