Writing shell script to sort text file data from given directory with for loop in ubuntu as:
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-------"
But this script is giving me error or message like(even tho' i have text files):
ls: cannot access *.txt: No Such File or Directoy
I think there is problem with ls command,Is it syntactically wrong or what ? How to list out text files from given directory path ?