正则表达式中的$ 遇到makefile

来源:互联网 发布:https协议端口 编辑:程序博客网 时间:2024/06/05 04:25

今天再写一个makefile 时 

clean-temp:
rm  ` ls -a |grep ~$`

想要完成删除所有以~ 结尾的临时文件 

但是这样写不能完成,只能在terminal当中完成

会提示这样的错误:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
Makefile:2: recipe for target 'clean-temp' failed
make: *** [clean-temp] Error 1


原因:

makefile 指挥把  $$替换成$.

所以改成:

clean-temp:
rm  ` ls -a |grep ~$$`就ok了! 

0 0
原创粉丝点击