How to use offset in arrays in bash?
<p>Here is my code.</p>

<pre><code>#! /bin/bash
array=(3 2 1 0 0 0 0 0 0 0)
for i in {0..10}
do
    this=${array:$i:$((i+1))}
    echo $this
done
</code></pre>

<p>I want to print each number of my number separately. I have used this line to get the array elements using an offset number.</p>

<pre><code>    this=${array:$i:$((i+1))}
</code></pre>

<p>However I am only getting 3 printed and rest all are new lines. I basically want to print 3, 2, 1 etc on separate lines. How do I correct this? </p>