This question is related to my previous question here: How to pass a value from JSON to a command in shell script at Docker?
I have a shell script file as below:
name=$(jq '.name' /xxx/deploy-tool.json)
nugetFileVersion=$(jq '.version' /xxx/deploy-tool.json)
#bash
#echo $name
# TODO how to pass value from JSON to the command below
# install dot net nuget
dotnet tool install -g $name --version $nugetFileVersion --add-source /xxx/
Here is my deploy-tool.json
file
{
"name": "xxx.DEPLOY",
"version": "1.2.0-dev.29"
}
When I run the script above in the dockerfile, I got an error message saying:
Specified version '"1.2.0-dev.29"' is not a valid NuGet version range.
I tried to check dotnet-tool install
documentation here: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-tool-install
However, I could not find anything useful.
How do I pass the nugetFileVersion
from the jq
command to the dotnet tool install
's version parameter like how I managed to do so in powershell like the image below:
Thank you