<p>Hope all is well. I am stuck with this Pod executing a shell script, using the BusyBox image. The one below works,</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: loop
  name: busybox-loop
spec:
  containers:
  - args:
    - /bin/sh
    - -c
    - |-
      for i in 1 2 3 4 5 6 7 8 9 10; \
      do echo &quot;Welcome $i times&quot;; done
    image: busybox
    name: loop
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Never
status: {}
</code></pre>
<p>But this one doesn't works as I am using &quot;- &gt;&quot; as the operator,</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  labels:
    run: busybox-loop
  name: busybox-loop
spec:
  containers:
  - image: busybox
    name: busybox-loop
    args:
    - /bin/sh
    - -c
    - &gt;
    - for i in {1..10};
    - do
    - echo (&quot;Welcome $i times&quot;);
    - done
  restartPolicy: Never
</code></pre>
<p>Is it because the for syntax &quot;for i in {1..10};&quot; will not work on sh shell. As we know we don't have any other shells in Busybox or the &quot;- &gt;&quot; operator is incorrect, I don't think so because it works for other shell scripts.</p>
<p>Also when can use &quot;- |&quot; multiline operator(I hope the term is correct) and &quot;- &gt;&quot; operator. I know this syntax below is easy to use, but the problem is when we use double quotes in the script, the escape sequence confuses and never works.</p>
<p>args: [&quot;-c&quot;, &quot;while true; do echo hello; sleep 10;done&quot;]</p>
<p>Appreciate your support.</p>

Celtic Bean
<p><code>...But this one doesn't works as I am using &quot;- &gt;&quot; as the operator...</code></p>
<p>You don't need '-' after '&gt;' in this case, try:</p>
<pre><code>apiVersion: v1
kind: Pod
metadata:
  name: busybox
  labels:
    run: busybox
spec:
  containers:
  - name: busybox
    image: busybox
    args:
    - ash
    - -c
    - &gt;
      for i in 1 2 3 4 5 6 7 8 9 10;
      do
      echo &quot;hello&quot;;
      done
</code></pre>
<p><code>kubectl logs pod busybox</code> will print hello 10 times.</p>
