title: how to grep a variable in the shell program?
body: <pre><code>#!/bin/bash
  
  for ((var=0; var&lt;20; var++))
  do
  echo " Number is: $(grep 'Multiple_Frame = echo **$var**'  20mrf.txt | wc -l)" &gt;&gt;statisic.txt 
  
  done
  </code></pre>
  
  <p>This shell program cannot produce correct result which maybe the reason of wrong variable returning in the second grep command. </p>
  
  <p>How can I grep a variable within the second echo sentence? to grep different things according to the var changing?</p>
  
  <p>Many thanks!</p>