title: How to declare array in shell script?
body: <p>I am trying to declare an array in my shell script and then have written a for loop to access those array elements into another file. But it is only taking the first element. I've tried the below :</p>
  <pre><code>raw_cd=(1150 1151)
  i=0
  
  
  for i in &quot;${raw_cd[@]}&quot;
  do
    grep -wr  &quot;${raw_cd[@]}&quot; file1.txt  &gt; /opt/tmp/raw.txt
    echo &quot;$i&quot;
  done
  </code></pre>
  <p>It is taking only the first element 1150 and also giving output as :-</p>
  <pre><code>file1.txt:|1150|
  file1.txt:|1150|
  file1.txt:|1150|
  </code></pre>
  <p>where am i doing wrong?</p>