On Wed, Jan 19, 2022 at 11:19 PM Paul Smith <psm...@gnu.org> wrote:
>
> On Wed, 2022-01-19 at 19:47 +0800, Hongyi Zhao wrote:
> > This reminds me of the following similar problems when using GNU
> > Makefile variable assignment as discussed here [1]:
>
> I recommend that people read the GNU make manual, rather than websites:
>
> https://www.gnu.org/software/make/manual/html_node/Using-Variables.html
>
> > VAL = foo
> > VARIABLE = $(VAL)
> >
> > In the above usage, can I also change to the following?
> >
> > VAL = foo
> > VARIABLE = $$VAL
>
> I don't quite understand the question.  Of course you CAN do that.  If
> your question is, does it mean the same thing then no, it does not.
>
> The first one sets the value of the variable VARIABLE to the string
> $(VAL) and the second one sets the value of the variable VARIABLE to
> the string $$VAL.
>
> These are definitely not the same: when $(VARIABLE) is expanded after
> the first one, the expansion will be "foo" (without quotes).  When
> $(VARIABLE) is expanded after the second one, the expansion will be the
> literal string "$VAL" (without quotes).  So they're not the same.

Maybe I didn't express my question clearly. I actually meant to say if
the following one are equivalent to obtain the exit code:

$($?) and $$?

HZ

Reply via email to