title: Using select statement to repeat process in bash script
body: <p>I'm super close to finishing my assignment but I'm a little stumped on one part.</p>
  
  <p>Here's what I got: </p>
  
  <pre><code>for file in $1
  do
      wget "$1" -O "output-$1.html" -q
      cat output-$1.html | grep -o '&lt;a .*href=.*&gt;' | 
      sed -e 's/&lt;a /\n&lt;a /g' | 
      sed -e 's/&lt;a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' | 
      grep 'http' &gt; ~/bcache/$1.bcache
  
  select LINK in `cat ~/bcache/$1.bcache` "q_to_quit"
      do
          if [ $LINK = "q_to_quit" ] 
             then
               exit 1
             else 
                 repeat lines 3-7
          fi
      done
  </code></pre>
  
  <p>Lines 3-7 take a url and output to an html file, where that html file is then sorted through with grep and sed to only pull out "http://...", which is then put into a file which is stored into a directory called bcache.</p>
  
  <p>The select statement prints out all of the "http://..." with numbers preceding them, with the last option being q_to_quit.</p>
  
  <p>I can't figure out how to repeat the process of lines 3 through 7 once someone enters a number (which corresponds to a url, which needs to be sorted, saved, and stored, rinse and repeat.)</p>