<p>I'm trying to invoke a bash script on a container on a remote VM like below,</p>
<pre><code>sshpass -p password ssh ubunt@${slave_ip} &quot;kubectl exec -it pod_name -c container_name -- bash -c &quot;/my_script.sh --${version} --${remote_ip} --${password} --${range} --${env}&quot;&quot;
</code></pre>
<p>Problem being, only the 1st argument - <code>version</code> gets parsed and the rest are lost.</p>
<p>What am I doing wrong &amp; how to pass multiple arguments correctly using <code>kubectl</code>, many thanks.</p>

Goku
<p>This should work better :</p>
<pre><code>sshpass -p password ssh ubunt@${slave_ip} &quot;kubectl exec -it pod_name -c container_name -- bash -c '/my_script.sh --${version} --${remote_ip} --\&quot;${password}\&quot; --${range} --${env}'&quot;
</code></pre>
<p>even though it can still have problems if you <code>$password</code> contains special characters like quotes, so try to think of different ways to pass it.</p>
<p><strong>Update</strong></p>
<p>I tested with sshpass, which worked as well.</p>
<p>Can you run following and post result ? (Notice the <code>printf %s__</code>)</p>
<pre><code>sshpass -p password ssh ubunt@${slave_ip} &quot;kubectl exec -it pod_name -c container_name -- bash -c 'printf %s__ /my_script.sh --${version} --${remote_ip} --\&quot;${password}\&quot; --${range} --${env}'&quot;
</code></pre>
