linux – bashMakefile中双符号的意思是什么?

linux – bashMakefile中双符号的意思是什么?,第1张

概述在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 synt 在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 =>使用两个美元的标志

总结

以上是内存溢出为你收集整理的linux – bash / Makefile中双符号的意思是什么?全部内容,希望文章能够帮你解决linux – bash / Makefile中双符号的意思是什么?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/1048852.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存