I decided to write a little bash parser script I kinda succ in bash and jq. So I using curl to get json from reddit and jq to extract value from it, I want get titles as list of sentences what is the best way to get it?
Code example
#getting title
titles=($(echo "${json}" | jq '.data.children[].data.title'))
echo "full list is"
echo ${titles[@]}
echo
#copyed by hand from previos output^
hand_titles=("Developers Should Celebrate Software Development Being Hard" "Lies we tell ourselves to keep using Golang")
echo "I want to call var like this and get this output:"
echo ${hand_titles[0]}
echo
echo "But instead I get this: "
echo ${titles[0]}
Console output
full list is
"Developers Should Celebrate Software Development Being Hard" "Lies we tell ourselves to keep using Golang"
I want to call var like this and get this output:
Developers Should Celebrate Software Development Being Hard
But instead I get this:
"Developers
I want to use a for loop to Iterate trough list in parallel and use ${titles[i]} and for this I need output a sentence "Developers Should Celebrate Software Development Being Hard" not a damn word
Maybe I suppose record it to file or something then read it to use it properly I dunno