title: Bash Script: All files in directory
body: <p>I'm a new coder and having trouble writing a bash script in which all the log files in my directory (number001.log, number002.log, ect.) get processed via a perl script (map_shifts2PDB.pl) and the results of each numberXXX.log file are concatenated to a results.out file. The perl script requires the following arguments <code>./map_shifts2PDB.pl &lt;path of logfile&gt; &lt;path of test.pdb&gt; (constant)</code> and the number of the log file to be processed. I don't know how to synchronize this to the log file being read in the loop. This is what I have so far:</p>
  
  <pre><code>#!/bin/bash
  
  for f in ~/TrpCage_1L2Y/1L2Y_min_explicit/model1_charged/calculate/*.log; do
  
  ./map_shifts2PDB.pl ~/TrpCage_1L2Y/1L2Y_min_explicit/model1_charged/calculate ~/TrpCage_1L2Y/1L2Y
  _min_explicit/model1_charged/test.pdb 1 &gt;&gt; results.out
  
  done
  </code></pre>