问题
I'm getting above error in my shell script. My task is that I want to delete from my Docker Hub private repository tags which are older than 30 days. So here I have written a small script. After executing I'm getting a parse error.
It has jq, echo and curl
#!/bin/sh
username=rashidmd
password=xxxxxxxx
HUB_TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'$username'", "password": "'$password'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)
#echo $HUB_TOKEN
echo
REPO=$( curl -s -H "Authorization: JWT ${HUB_TOKEN}" "https://hub.docker.com/v2/repositories/$username/" | jq '.results[] | .name' )
echo $REPO
for i in $REPO
do
IMAGE_TAGE=$( curl -s "https://hub.docker.com/v2/repositories/$username/$i/tags" -H "Authorization: JWT ${HUB_TOKEN}" | jq '.results[] | .name' )
echo $IMAGE_TAGE
done
Here is the error :
"repo-test" "repo-test2" parse error: Invalid numeric literal at line 1, column 8
parse error: Invalid numeric literal at line 1, column 8
来源:https://stackoverflow.com/questions/62634141/parse-error-invalid-numeric-literal-at-line-1-column-8-in-script