title: List out text files from given directory in unix
body: <p>Writing shell script to sort text file data from given directory with for loop in ubuntu as:</p>
  
  <pre><code>   echo "Enter directory Name"
     read dr
     path= ` find /home/user -name $dr `
     for x in ` ls *.txt $path ` 
       do
         sort $x
       done
     echo "------Script finished-------"
  </code></pre>
  
  <p>But this script is giving me error or message like(even tho' i have text files):  </p>
  
  <pre><code>   ls: cannot access *.txt: No Such File or Directoy
  </code></pre>
  
  <p>I think there is problem with ls command,Is it syntactically wrong or what ? How to list out text files from given directory path ?</p>