<p>I am trying below command</p>

<pre><code>kubectl exec -it sss-pod-four  echo "hi" &gt;&gt; /mnt/sss/testnew.txt
</code></pre>

<p>But it throws error</p>

<pre><code>-bash: /mnt/sss/testnew.txt: No such file or directory
</code></pre>

<p>What is the best way to achieve this</p>

<p>Found a similar question <a href="https://stackoverflow.com/questions/43499313/executing-multiple-commands-or-from-a-shell-script-in-a-kubernetes-pod">here</a>   and below command works now</p>

<pre><code> kubectl exec -it sss-pod-four  -- bash -c "echo hi &gt; /mnt/sss/testnew.txt" 
</code></pre>
