We are trying to get jqv1.5 64bit to parse an array then echo out the result.
Do we have the correct jq syntax?
#!/bin/bash
declare -a nameArr
nameArr=("Leia" "Darth Vader" "Anakin" "Han Solo" "Yoda")
jq -c -n "$nameArr"
gives error
jq: error: syntax error, unexpected $end (Unix shell quoting issues?) at <top-level>, line 1:
Leia,
jq: 1 compile error
jq -c -n "$nameArr"passes only the first element of the array, so it runsjq -c -n "Leia,"with your original input. There isn't a good way to pass a shell array (which can contain any list of valid C strings) inside a single C string.