title: How to use a variable in find command?
body: <p>I am totally new in bash so sorry if my question is not well formatted or does not make sense :)</p>
  
  <p>I'm trying to do something like that:</p>
  
  <pre><code>#..................... previous code where F is defining
  
  filename="$F";
  echo "$filename";
  find . -name ????? | while read fname; do
      echo "$fname";
  done;
  </code></pre>
  
  <p>I want to use my variable $filename in find command (instead of ????), but I don't know how. I add some fixed value there for testing purpose, for example "abc.txt" (which exists and is stored in my variable), it works well, I just don't know how to use variable in find command.</p>
  
  <p>Something like</p>
  
  <pre><code>find . -name '$filename.txt' | while read fname;
  </code></pre>
  
  <p>UPDATE: (I have 2 files (.xml and .txt) with the same name in folder)</p>
  
  <pre><code>find . -type f -name \*.xml | while read F; 
      do something || echo $F;
      cat "$F";
      #name without extenssion
      filename="${F%.*}";
      echo "$filename";
      find . -name "$filename.txt" | while read fname; do
          echo "$fname";
      done;
  done;
  </code></pre>