<p>the following script works :</p>
<pre><code>#!/bin/bash
kubectl exec -ti mypod -- bash -c &quot;cat somefile&quot;
</code></pre>
<p>but</p>
<pre><code>#!/bin/bash
command=&quot;cat somefile&quot;
kubectl exec -ti mypod -- bash -c $command
</code></pre>
<p>does not.</p>
<pre><code>chmod +x myscript.sh
./myscript.sh
</code></pre>
<p>the prompt never returns!!!</p>
<p>What is wrong with the second script?
Thanks in advance,
Abdelghani</p>

Abdelghani
<p>You are missing the quotes. <code>command=&quot;cat somefile&quot;</code> will store in the variable the string <em>cat somefile</em>.</p>
<p>The script should look like this:</p>
<pre><code>#!/bin/bash
command=&quot;cat somefile&quot;
kubectl exec -ti mypod -- bash -c &quot;$command&quot;
</code></pre>
