title: unable to iterate through all the elements in the for loop
body: <p>I want to ssh to multiple remote server and check the raid status if it is mounted read only.</p>
  
  <p>I wrote a for loop for this and the for loop is only taking the last elemnet in the list. It is not iterating from 1st elemnt, 2nd eklement and so on,</p>
  
  <pre><code>  for i in $(cat /home/priyashree/server.txt);do
       machine_ip=$(getent hosts $i | awk {'print $1'})
       machine_info="${i},${machine_ip}"
       machine_new_ip="$(echo ${machine_info}|cut -d, -f2)"
       echo ${machine_new_ip}
    done
  
  
   for machineip in $machine_new_ip;do
        raid_status=$(ssh -o StrictHostKeyChecking=no $machineip mount | grep -e '/dev/md2'| cut -d'(' -f2| cut -d, -f1) 
        echo "Raid status for machine $machine_new_ip is $raid_status"
      done```
  
  $machine_new_ip has a list of IP as below
  aa.bb.cc.dd
  xx.zz.ee.ff
  
  The 2nd for loop will only ssh to the 2nd element (xx.zz.ee.ff) in the list and the 1st element is ignored. If new IPs are added to the list the problem repeats. All the elements in the beginning are skipped only the last one is considered. Please help to correct the for loop so that it iterates over all the elements.
  </code></pre>