jq:错误:未在< top-level>中定义round/0. [英] jq: error: round/0 is not defined at <top-level>
本文介绍了jq:错误:未在< top-level>中定义round/0.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
jq中的回合功能不起作用.
round function in jq doesn't work.
$ jq '10.01 | round'
jq: error: round/0 is not defined at <top-level>, line 1:
10.01 | round
jq: 1 compile error
$ jq --help
jq - commandline JSON processor [version 1.5-1-a5b5cbe]
我需要做什么?
推荐答案
在您的版本中似乎没有round
这样的名称.升级jq或使用floor
实施round
:
Seems like round
is unavailable in your build. Either upgrade jq or implement round
using floor
:
def round: . + 0.5 | floor;
用法示例:
$ jq -n 'def round: . + 0.5 | floor; 10.01 | round'
10
这篇关于jq:错误:未在< top-level>中定义round/0.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文