title: I want to write a shell script which reads strings until a string is introduced twice
body: <p>I am new to shell scripts, but I tried the following: </p>
  
  <pre><code>#!/bin/sh
  
  declare -a s
  read string1
  s[0] = string1
  
  while ((a&lt;=2))
  do
      read string2
      for i in "${s[@]}"
      do
           if $i=string2 
           then
               a=3
               exit 1
           fi
      done
      s[@+1]=string2
  done
  </code></pre>
  
  <p>It does not work, and I am not even sure that I need to use arrays. Any help would be great.</p>