parse error: Invalid numeric literal at line 1, column 8 in script

大城市里の小女人 提交于 2020-07-10 06:58:07

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!