预先启动并在条件下添加双重标价
在使用 makefile 和 bash shell 脚本时,我最终得到了一个变量,其中包含:
build_ext --b2-args=libtorrent-python-pic=on --b2-args=address-model=32
我需要在前面加上 --global-option=
并在正确的位置附加双引号,例如:
--global-option=build_ext --global-option=--b2-args="libtorrent-python-pic=on" --global-option=--b2-args="address-model=32"
请注意 --b2-args=
各不相同,不能视为理所当然。
到目前为止,我在前置部分所做的是使用 bash 数组:
printf "\x2D\x2Dglobal-option=%s " "${myarray[@]}"
但我宁愿使用 sed
来代替。
Playing with makefile and bash shell scripting where I ended-up having a variable containing:
build_ext --b2-args=libtorrent-python-pic=on --b2-args=address-model=32
I need to prepend --global-option=
and append double-quotes at the right place such as:
--global-option=build_ext --global-option=--b2-args="libtorrent-python-pic=on" --global-option=--b2-args="address-model=32"
Note that --b2-args=
varies and cannot be taken as granted.
So far what I did for the prepending is using a bash array:
printf "\x2D\x2Dglobal-option=%s " "${myarray[@]}"
But I'd rather have a one-liner using sed
instead.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用任何SED:
Using any sed: