title: How do I pass multiple arguments to a shell script into `kubectl exec`?
body: <p>Consider the following shell script, where <code>POD</code> is set to the name of a K8 pod.</p>
  <pre><code>kubectl exec -it $POD -c messenger -- bash -c &quot;echo '$@'&quot;
  </code></pre>
  <p>When I run this script with one argument, it works fine.</p>
  <pre><code>hq6:bot hqin$ ./Test.sh  x
  x
  </code></pre>
  <p>When I run it with two arguments, it blows up.</p>
  <pre><code>hq6:bot hqin$ ./Test.sh  x y
  y': -c: line 0: unexpected EOF while looking for matching `''
  y': -c: line 1: syntax error: unexpected end of file
  </code></pre>
  <p>I suspect that something is wrong with how the arguments are passed.</p>
  <p><strong>How might I fix this so that arguments are expanded literally by my shell and then passed in as literals to the <code>bash</code> running in <code>kubectl exec</code>?</strong></p>
  <p>Note that removing the single quotes results in an output of <code>x</code> only.
  Note also that I need the <code>bash -c</code> so I can eventually pass in file redirection: <a href="https://stackoverflow.com/a/49189635/391161">https://stackoverflow.com/a/49189635/391161</a>.</p>