Store value to variable in Shell script
This question already has an answer here:
You have to use the right quotation, like this:
total_rows=`echo "$emails" | ./jq '.total_rows'`
The `` will execute the command and give total_rows
the value of it, so whatever would be the output of
echo "$emails" | ./jq '.total_rows'
will so be stored in total_rows
.
上一篇: 如何将bash命令的输出存储在变量中?
下一篇: 将值存储到Shell脚本中的变量