 <p>If you have an array named <code>array</code> and a variable <code>pn</code> holding the number of elements in <code>array</code>:</p> <pre><code>$ array=('+47177372141' '+41753459833' ) $ pn=2 $ for ((i=0;i&lt;$pn;i++)); do echo ${array[$i]}; done +47177372141 +41753459833 </code></pre> <p>Another way to iterate over an array (be it numerically indexed or associative) is:</p> <pre><code>$ for key in "${!array[@]}"; do echo "$key: ${array[$key]}"; done 0: +47177372141 1: +41753459833 </code></pre>