在 jq bash 脚本中连接一个字符串变量
concat a string variable in jq bash script
这是我的 bash 脚本
test.sh
host='select((.tag_name!="dev")
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | <iwant host variable placed here> ][0].assets[0].browser_download_url'
我想做如下的事情
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | select(.tag_name=="dev" )][0].assets[0].browser_download_url'
试试这个:$(主机)
host='select(.tag_name=="dev")'
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | $(host) ][0].assets[0].browser_download_url'
... | jq -r '[.[] | '"$host"' ][0].assets[0].browser_download_url'
这是我的 bash 脚本 test.sh
host='select((.tag_name!="dev")
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | <iwant host variable placed here> ][0].assets[0].browser_download_url'
我想做如下的事情
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | select(.tag_name=="dev" )][0].assets[0].browser_download_url'
试试这个:$(主机)
host='select(.tag_name=="dev")'
curl -H "Authorization: token <token>" https:<git release url> | jq -r '[.[] | $(host) ][0].assets[0].browser_download_url'
... | jq -r '[.[] | '"$host"' ][0].assets[0].browser_download_url'