#bash (2020-08)
A channel for bash scripting
2020-08-07

Brij S
Hey bash experts!
workspace_id=$(curl -s --header "Authorization: Bearer ${TFE_TOKEN}" --header "Content-Type: application/vnd.api+json" "<https://some/giant/url/here>" | jq -r .data.id)
echo "Workspace ID is ${workspace_id}"
when I run that curl command in shell, it works fine but when I put that into a shell script it just returns null, any ideas why?

bradym
Most likely is that TFE_TOKEN
is not correctly set in the script
I’d do two things to troubleshoot:
set -x
before the workspace_id
line, and change your curl command to curl -sS
so you’ll get any errors from curl that are currently being suppresed.

Brij S
that was it! the token wasnt set

