I have set a variable like this below-
domain= ("*.abc" "*.xyz" "*.123")
I want set the value of this variable in a json file like below-
"Items": [
"*.abc",
"*.xyz",
"*.123",]
But, the problem is bash script is skipping quotation "" and taking only inside the quotation. Other than this, bash is also trying to take the value as command. I just want to set the value in Items array including commas, that's it.
I am using jq --arg e1 ${domain[@]} to set the domain variable to e1 environment variable.
And getting this below error -
jq: error: syntax error, unexpected '*', expecting $end (Windows cmd shell quoting issues?) at <top-level>, line 1: *.xyz.com
domain= ('"*.abc"' '"*.xyz"' '"*.123"').=produces a syntax error.domain=('"*.abc"' '"*.xyz"' '"*.123"'). I assume the space was not present in the original code of the OP as well, otherwise execution would not even have reached thejqstatement.