【发布时间】:2018-04-21 14:54:51
【问题描述】:
我很难解决这个问题。我需要向 GITLAP API 提供基于我拥有的文件创建的问题。通常文件的输出如下:
Microsoft xxx xxxxx - 远程代码执行 xxxxxx- 2018 年 4 月 xxxxx 更新 Red Hat Enterprise xxxx - java-1.8.0-xxxxx 多个 xxxxxxx- RHSA-xxxxxx
到目前为止一切顺利,我已经通过以下方式处理了这个问题:
while read in; do
curl --request POST --header "PRIVATE-TOKEN: xxxxxxxxxxxxx" https://gitlab.com/api/v3/projects/xxxxxx/issues?title="$in";
done < ~/input_file
现在的问题是我需要为此添加第二个变量,因为我需要介绍每个问题的描述,现在我的输入文件更改如下:
Microsoft 恶意软件保护 - 远程代码执行漏洞 - 2018 年 4 月安全更新 40697
Red Hat Enterprise Linux 6 - java-1.8.0-openjdk 多个漏洞 - RHSA-2018:1188 40861
我想构建这样的东西:
while read in;
curl --request POST --header "PRIVATE-TOKEN: xxxxxxxxxxx" "https://gitlab.com/api/v4/projects/xxxxx/issues?title=$in&description=https://myspecialink.com/portal/notifications/show/$id";
done < ~/input_file
例如:
-
$in: 必须是除我上面表示的粗体数字之外的所有内容。 -
$id: 只能是上面加粗的数字。
有人可以帮我指出实现这一目标的最佳方法吗?
【问题讨论】: