Shell script -- how to store curl command WITH variables result into another variable?
<p>Currently I have a curl command that I want to store in a local variable. I know I could use `` or $() to get it done, but a variable inside the command stops me from doing so.</p>

<p><code>local sample_mapping="$(curl -XGET '${search_host}/${index}/_mapping')"</code></p>

<p>where search_host and index are two variables previously set. This command fails because <code>Couldn't resolve host '$search_host'</code></p>

<p>The other posts didn't talk about what to do when dealing with variables. Anyone has any idea?</p>