title: Read file names from directory in Bash
body: <p>I need to write a script that reads all the file names from a directory and then depending on the file name, for example if it contains R1 or R2, it will concatenates all the file names that contain, for example R1 in the name.</p>
  
  <p>Can anyone give me some tip how to do this?</p>
  
  <p>The only thing I was able to do is:</p>
  
  <pre><code>#!/bin/bash
  
  FILES="path to the files"
  
  for f in $FILES
  do
    cat $f
  done
  </code></pre>
  
  <p>and this only shows me that the variable FILE is a directory not the files it has.</p>