在 makefile 中的 sed 命令模式中写入美元符号 [英] Write Dollar sign in sed command pattern inside makefile

查看:23
本文介绍了在 makefile 中的 sed 命令模式中写入美元符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含此命令的生成文件:

I have a makefile that contains this command:

sed '/^$/d'

当我运行它时,我得到了:

when I ran it I got:

sed '/^d'
sed: -e expression #1, char 3: unterminated address regex

看起来它解释了美元符号,我该如何防止这种情况发生?

looks like it interprets the dollar sign, how can I prevent that from happening?

推荐答案

你必须将配方中的所有美元符号加倍,否则 make 会将它们视为引入了 make 变量:

You have to double all dollar signs in a recipe, otherwise make treats them as introducing a make variable:

sed '/^$$/d'

如果您搜索美元符号生成文件"或类似内容,您会发现几乎这个确切问题的数十个甚至数百个答案.

If you search for "dollar sign makefile" or similar you'll find tens if not hundreds of answers to virtually this exact question.

这篇关于在 makefile 中的 sed 命令模式中写入美元符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆