I'm tring to set a new variable with the piped output of another variable but it is not working. What's wrong with my syntax?
Using command substition $()
a="{\"a\": 1}"
echo $a
# output is: {a: 1}
echo $a | jq '.a'
# output is: 1
b=$($a | jq '.a')
# error: {"a":: command not found
Without command substition
b=$a | jq '.a'
# b is empty