0

I can't find how i would be able to use varable for the jq command in this bash script for linux. this would be used in a while loop to find a specific tag. In the code this bellow i have tried to do it but with nu success.in the first line you can see the full curl command without variable

#!/bin/bash

current_version=$(curl 'https://registry.hub.docker.com/v2/repositories/jensdl/testimage/tags/'|jq '."results"[0]["name"]' | tr -d '"') 

list_number=$0
list_number=$(($listnumber + 1))
search_tags=$(echo "'.\"results\"[REPLACEME][\"name\"]'" | sed "s/REPLACEME/$list_number/")
echo $search_tags
current_version=$(curl 'https://registry.hub.docker.com/v2/repositories/jensdl/testimage/tags/'| jq $search_tags | tr -d '"')  

I tried the code above, and tried googeling for other solutions, but with nu success.

jensDL
  • 11
  • 2
  • Fwiw, skip `| tr -d '"'` and add the `-r` or `-j` option to `jq` instead. It won't solve the problem but will make it cleaner. – Ted Lyngmo Nov 17 '22 at 22:01

0 Answers0