I am executing the below curl command in shell script. But I am getting command not found error. So wanted to check if I am making any mistake while executing it.
return = $(curl -s --location --request GET --url 'https://testurl.mywebsite.com/api/accts?Id=trst_id&var=test_var' --header 'type: app/test')
echo "data is: ${return}"
I am getting the error:
return: command not found
Kindly let me know if there is a problem with the way I am trying to execute the curl command.
Thank you.
CodePudding user response:
Like dan pointed out in comments, the extra whotespaces between the variable and command caused the issue. After removing extra whitespaces it worked.
return=$(curl -s --location --request GET --url 'https://testurl.mywebsite.com/api/accts?Id=trst_id&var=test_var' --header 'type: app/test') echo "data is: ${return}"