添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

我在groovy脚本中使用bash执行curl。

   descr = """
    curl --silent -k -u test:test "https://bitbucket/rest/api/1.0/projects/test/repos/test/pull-requests?state=all&at=refs/heads/release/test" | /usr/bin/core_perl/json_pp
    def descrtxt = ['bash', '-c', descr].execute()
    descrtxt.waitFor()

Problem is curl ignoring & symbol in request.And instead of give me only request with test refs,give me all pr. I try to escape it with '&' and \& but no luck

5 个评论
前缀为``或在网址周围使用单引号应该可以?
cfrick 不幸的是,没有
对不起,评论吃了一个( ) - 我的意思是( ) - 双反斜线
cfrick - groovy脚本挂起。如果我在bash控制台运行命令,得到一个错误 - 在请求目标中发现无效字符。有效字符在RFC 7230和RFC 3986中定义。
Then \\& maybe? Are you sure the error is with the & and not with the / inside at?
linux
bash
shell
groovy
stevemayster
stevemayster
发布于 2022-04-19
1 个回答
cordigliere
cordigliere
发布于 2022-04-20
0 人赞同

在bash命令中使用''',在curl命令中使用双倍。

descr = '''