for loop reading a file bash code example
Example 1: for loop in bash for files
#!/bin/bash
FILES=/path/to/*
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
cat $f
done
Example 2: read file line loop in bash
for word in $(cat peptides.txt); do echo $word; done