[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do you echo a shell variable reference

From: Eric Blake
Subject: Re: How do you echo a shell variable reference
Date: Mon, 13 Apr 2015 16:43:37 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/13/2015 04:24 PM, Arthur Schwarz wrote:
> I am trying to echo:
>    echo 'exit $status' >> file
> from the Makefile generated by 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:

        echo 'exit $$status' >> file

Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library

reply via email to

[Prev in Thread] Current Thread [Next in Thread]