Help with BASH command to variable

Soldato
Joined
6 Jan 2013
Posts
21,928
Location
Rollergirl
Been throwing everything at this, but just can't get it to play nice. I'm trying to extract info from an api.

If I have :

Code:
echo "$jsonTxt" | jq '.[0].algo' | sed "s/\"//g"

It outputs :

Code:
x15

That output is perfect, it's the first algo returned. I want that "x15" into a variable so I can use it later in the script, so I'm trying :

Code:
outputTxt=$("$jsonTxt" | jq '.[0].algo' | sed "s/\"//g")
echo "$outputTxt"

But it errors, saying :

Code:
line 16: "[{"algo":"x15","score":"0.00443727"},{"algo":"x13","score":"0.0031609"},{"algo":"x11","score":"0.00192839"},{"algo":"nscrypt","score":"0.0014518"},{"algo":"scrypt","score":"0.000689165"},{"algo":"nist5","score":"0"}]": command not found
 
Back
Top Bottom