title: Is it possible to roll a dynamically-generated Javascript array (Node) into a Bash array?
body: <p>So I'm currently rolling a few different <code>env</code> variables into a Docker container using the following syntax:</p>
  <p>Node script:</p>
  <pre><code>    process.env['VAR1'] = 'someArbitraryValue';
      process.env['VAR2'] = 'anotherArbitraryValue';
  </code></pre>
  <p>which then execs a bash script that looks like this:</p>
  <pre><code>params=()
  
  [[ ! -z &quot;$VAR1&quot; ]] &amp;&amp; params+=(-e &quot;VAR1=$VAR1&quot;)
  [[ ! -z &quot;$VAR2&quot; ]] &amp;&amp; params+=(-e &quot;VAR2=$VAR2&quot;)
  
  docker run &quot;${params[@]}&quot;
  </code></pre>
  <p>That works just fine since I know the names of those env variables in advance and I can just hardcode the bash command to grab their values and insert them into params. However, what I'd like to be able to do is allow for a dynamically-generated list of variables to be added to the params list.</p>
  <p>In other words, I run some function that returns an array that looks like:</p>
  <pre><code>var myArray = ['VAR3=somevalue', 'VAR4=anothervalue']
  </code></pre>
  <p>and is then passed into params by iterating through its contents and appending them. Since you can't set an array as an env variable in Bash, I'm not exactly sure if this is possible.</p>
  <p>Is there a way to perform this operation, or am I out of luck?</p>