title: Looping through the content of a file in Bash
body: <p>How do I iterate through each line of a text file with <a href="https://en.wikipedia.org/wiki/Bash_(Unix_shell)" rel="noreferrer">Bash</a>?</p>
  
  <p>With this script:</p>
  
  <pre><code>echo "Start!"
  for p in (peptides.txt)
  do
      echo "${p}"
  done
  </code></pre>
  
  <p>I get this output on the screen:</p>
  
  <pre><code>Start!
  ./runPep.sh: line 3: syntax error near unexpected token `('
  ./runPep.sh: line 3: `for p in (peptides.txt)'
  </code></pre>
  
  <p>(Later I want to do something more complicated with <code>$p</code> than just output to the screen.)</p>
  
  <hr>
  
  <p>The environment variable <strong>SHELL</strong> is (from env):</p>
  
  <pre><code>SHELL=/bin/bash
  </code></pre>
  
  <p><code>/bin/bash --version</code> output:</p>
  
  <pre><code>GNU bash, version 3.1.17(1)-release (x86_64-suse-linux-gnu)
  Copyright (C) 2005 Free Software Foundation, Inc.
  </code></pre>
  
  <p><code>cat /proc/version</code> output:</p>
  
  <pre><code>Linux version 2.6.18.2-34-default (geeko@buildhost) (gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)) #1 SMP Mon Nov 27 11:46:27 UTC 2006
  </code></pre>
  
  <p>The file peptides.txt contains:</p>
  
  <pre><code>RKEKNVQ
  IPKKLLQK
  QYFHQLEKMNVK
  IPKKLLQK
  GDLSTALEVAIDCYEK
  QYFHQLEKMNVKIPENIYR
  RKEKNVQ
  VLAKHGKLQDAIN
  ILGFMK
  LEDVALQILL
  </code></pre>