title: accessing elements in array in script
body: <p>i am trying to print all parameters in bash script "one by one".<br>
  fro example i want to run:<br>
      ./myscript hello all friends<br>
  and see below result:  </p>
  
  <pre><code> hello  
   all  
   friends.  
  </code></pre>
  
  <p>i wrote below code:</p>
  
  <pre><code>#!/bin/bash
  li=$@
  for(( j=0;j&lt;$#;j++));
  do
      echo ${li[$j]}
  done
  </code></pre>
  
  <p>bug when i run my code it prints all of argument at once:  </p>
  
  <pre><code>hello all friends
  </code></pre>
  
  <p>i know i can do that by changing the for structure to below format:  </p>
  
  <pre><code>#!/bin/bash
  li=$@
  for j in $li;
  do
      echo $j
  done
  </code></pre>
  
  <p>but i didn't want to change the code such as above.<br>
  please help me.<br>
  thank you in advance.  </p>