[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do you echo a shell variable reference
From: |
Harlan Stenn |
Subject: |
Re: How do you echo a shell variable reference |
Date: |
Mon, 13 Apr 2015 23:14:18 +0000 |
Eric Blake writes:
> On 04/13/2015 04:24 PM, Arthur Schwarz wrote:
> >
> > I am trying to echo:
> > echo 'exit $status' >> file
> >
> > from the Makefile generated by Makefile.am. What I get is:
> > echo 'exit $status' >> file
> >
> > in the Makefile, which is correct, but in execution (make check) I get
> > exit tatus
> >
> > in file. I have tried variations of $status to no avail. Any idea how I can
> > get the correct result in file?
>
> The same as any other time you want a literal $ to be passed through to
> the shell when writing Makefile snippets: escape the $ with another $,
> so that 'make' won't try to treat it as an expansion of ${s} at make time:
>
> foo:
> echo 'exit $$status' >> file
Ah, I missed the type of expansion/quoting being desired.
H