bash - make 函数如何在 makefile 中运行的 Bash 循环中工作
问题描述
make 函数如何在 Bash 循环中工作,尝试过:
Part=hey high huh
Str=hey do not be high huh
entity:
@for n in $(Part) ;{ \
echo $(subst $$n,,$(Str)); \
}
删除某些字符串..不起作用,如何解决?
解决方案
这是make内部的一个解决方案:
Part=hey high huh
Str=hey do not be high huh
entity:
$(foreach p,$(Part),echo $(filter-out $(p),$(Str));)
请注意;
关闭之前)
用于分隔命令的echo
命令,因为它们将在 shell 的一行中执行。如果 shell 命令变得比简单的命令更复杂echo
,您最好使用成熟的罐头食谱。
推荐阅读
- c++ - C++ 如何检测 Windows Server 2019?
- python - 无法按名称找到元素
- dialogflow-es - 如何通过 V2 客户端库为节点 js 创建 OutPutContext
- python - 在 Selenium 网页中单击“显示更多交易”
- javascript - 具有 8 个不同值集的对象
- ruby-on-rails - Webpacker:启用监视模式或取消挂钩 webpacker:从资产编译:Rails 中的预编译任务?
- macos - 完全卸载protobuf
- css - Django 应用程序不加载 CSS 背景图像,但图像加载内联样式。有解决办法吗?
- apache-spark - 对于 HIVE 查询,Is OR 提供比 IN 更好的性能
- python - 按行和列在 matplotlib 中迭代生成子图 - 仅绘制最终轴