title: using nested loop(nested while)
body: <p>I have a code where this code goal is if your input match a word in my database it will print the 2nd from the sentence, which is the translation from the 1st word.</p>
  
  <p>The problem is this code print all the 2nd word in the database. I will be very thankful if you can correct me.
  this is my code:</p>
  
  <pre><code>cari=$(zenity --entry "Masukan Kata Yang Ingin Anda Cari:")
  IFS=" " read -ra field &lt;&lt;&lt; $cari
  b=(`cat Kamus2.txt | awk '{print $1}'`)
  d=(`cat Kamus2.txt | awk '{print $2}'`)
  for item2 in ${d[*]}
  do
      for item1 in ${field[*]}
      do
          for item in ${b[*]}
          do
              test  "$item1" = "$item" &amp;&amp; { echo -n "$item2 "; }
          done
      done
  done
  echo " " 
  </code></pre>
  
  <p>for example database:</p>
  
  <pre><code>Aku I
  Ingin Want
  Roti Bread
  Makan Eat
  </code></pre>
  
  <p>the output that i want for example:
  if I input <code>Aku Ingin Makan</code> the output will be <code>I Want Eat</code></p>
  
  <p>thank you very much for your time and patience </p>