Store a list of file into an array variable, and loop through the list:
files=($(ls -lah yourFolder/* | cut -d' ' -f X)) # X depend on which column is your file name, usually 14 in a local computer, but might differ.
for item in "${files[@]}"
do
echo $item
done
Or read the list from file then loop:
while read sample;
do
sample_list="$sample_list $sample"
done < sampleList.txt
for sample in $tissue_list
do
echo $sample
done
Source:
https://stackoverflow.com/questions/9954680/how-to-store-directory-files-listing-into-an-array