在Makefile中插入一个
shell脚本时,我们有(?)使用一个双重美元符号($$)来引用变量.为什么?
for number in 1 2 3 4 ; do \ echo $$number ; \ done
解决方法
根据
gnu make official doc:
Variable and function references in recipes have identical Syntax and
semantics to references elsewhere in the makefile. They also have the
same quoting rules: if you want a dollar sign to appear in your
recipe,you must double it (‘$$’). For shells like the default shell,
that use dollar signs to introduce variables,it’s important to keep
clear in your mind whether the variable you want to reference is a
make variable (use a single dollar sign) or a shell variable (use two
dollar signs).
简而言之:
> makefile variable =>使用一个美元符号> shell variable =>使用两个美元的标志
原文地址:https://www.jb51.cc/linux/393539.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。