Page 1 of 1
What does the $$ mean?
Posted: Tue Mar 05, 2013 3:04 am
by leetow2003
I read a Makefile,look:
Code: Select all
dep:
(for i in init/*.c;do echo -n "init/";gcc -M $$i;done) >> tmp_make
cp tmp_make Makefile
if I write a shell script using the same codes,I find the $$i must be replaced
by $i,why?I want to know what the $$ means?
Re: What does the $$ mean?
Posted: Tue Mar 05, 2013 3:25 am
by Combuster
What does $ mean to make?
Re: What does the $$ mean?
Posted: Tue Mar 05, 2013 3:32 am
by iansjack
In this instance, do you want the command interpreter to see the value of $i, or do you want it to see "$i"?
Re: What does the $$ mean?
Posted: Tue Mar 05, 2013 6:38 pm
by kohlrak
leetow2003 wrote:I read a Makefile,look:
Code: Select all
dep:
(for i in init/*.c;do echo -n "init/";gcc -M $$i;done) >> tmp_make
cp tmp_make Makefile
if I write a shell script using the same codes,I find the $$i must be replaced
by $i,why?I want to know what the $$ means?
I'm not 100% sure, but it could be that $$ is a makefile escape for $, while in shells $$ represents the process ID.