This is the content of my text file named fnames.txt:SAMPLE_NIKE_856_20170703*SAMPLE_ADIDAS_856_20170702*SAMPLE_ANTA_856_20170630*SAMPLE_JORDAN_856_20170627*SAMPLE_CONVERSE_856_20170229*This is my script named fn.sh:#!/bin/sh##while read LINEdo    find -name $LINEdone < fnames.txtIt returns nothing.What I want to happen is that in each line the script will execute the find command and the output will be stored in another text file called files.txt e.g:LINE 1:find -name SAMPLE_NIKE_856_20170703*then returns the filename that is looking for./SAMPLE_NIKE_856_20170703_80_20_304_234_897.datLINE 2:find -name SAMPLE_ADIDAS_856_20170702*then returns the filename that is looking for./SAMPLE_ADIDAS_856_20170702_56_98_123_245_609.datThe script will continue until all lines has been executed by find command.
How to execute a find command using a set of strings from a line in a text file
linux;bash;shell script
I finally found the answer. I just need to call the full file path of fnames.txt to /path/to/my/fnames.txt because I'm executing the script in another directory.#!/bin/sh##while read -r LINEdo    find -name $LINEdone < /path/to/my/fnames.txtOutput:./SAMPLE_NIKE_856_20170703_80_20_304_234_897.dat./SAMPLE_ADIDAS_856_20170702_56_98_123_245_609.dat