title: Bash: Echo nested variable
body: <p>I'm working on a vpn script I've forked and I want to add a dialogue option so that it takes user input separated by space, and then echo the input with some nested settings text into the vpn server.conf file.</p>
  <p>I'm not a programmer, but I really like bash and this is driving me nuts.</p>
  <h1>The script part</h1>
  <p>They're the same.</p>
  <p><a href="https://paste.ee/r/FKRnv" rel="nofollow noreferrer">https://paste.ee/r/FKRnv</a></p>
  <p><a href="http://pastebin.com/raw/U0tSNaCP" rel="nofollow noreferrer">http://pastebin.com/raw/U0tSNaCP</a></p>
  <p>The bottom two lines are just for echoing the result while testing.</p>
  <p>Now, the issue I'm having is this part:</p>
  <pre><code>echo 'push &quot;dhcp-option DNS $(echo $i)&quot;'  &gt;&gt; ./server.conf;
  </code></pre>
  <p>I've also tried the following and its variants with moving quotes around:</p>
  <pre><code>echo 'push &quot;dhcp-option DNS $i&quot;'  &gt;&gt; ./server.conf;
  </code></pre>
  <p>But that doesn't work as it echoes <code>$i</code> as text.
  No matter how I try to nest the <code>$i</code> variable, bash only echoes it as text, instead of user's input.</p>
  <h3>Examples of openvpn's configuration:</h3>
  <p>openvpn.net/index.php/open-source/documentation/howto.html#examples</p>
  <pre><code>;push &quot;dhcp-option DNS 10.8.0.1&quot;
  ;push &quot;dhcp-option WINS 10.8.0.1&quot;
  </code></pre>
  <h3>So in the end, all I would like is a result like this:</h3>
  <pre><code>push &quot;dhcp-option DNS 1.2.3.4&quot;
  push &quot;dhcp-option DNS 5.6.7.8&quot;
  </code></pre>
  <p>where 1.2.3.4 and 5.6.7.8 and so on are user input. However, the quotes around the dhcp-option make nesting difficult.</p>
  <p>Anyone got a better way to do this?</p>
  <p>I've tried many and searched for nesting before asking this.</p>
  <p>Thank you.</p>