Assigning an Array Parsed With jq to Bash Script Array
问题 I parsed a json file with jq like this : # cat test.json | jq '.logs' | jq '.[]' | jq '._id' | jq -s It returns an array like this : [34,235,436,546,.....] Using bash script i described an array : # declare -a msgIds = ... This array uses () instead of [] so when I pass the array given above to this array it won't work. ([324,32,45..]) this causes problem. If i remove the jq -s , an array forms with only 1 member in it. Is there a way to solve this issue? 回答1: Use jq -r to output a string