Submitted by abitowhit on Mon, 01/20/2020 - 10:59
Looping through some files I was having problems due to the full path.
Removing the path up to the file name was resolved by the use of ${} and # chars
Running this script should only echo the file name and not the full path /home/pi/bin/quickcpm/logs/filename
You can then use just the file name if you need to.
FILES=/home/pi/bin/quickcpm/logs/*.html
cd /home/pi/bin/quickcpm/logs
for f in $FILES
do
echo "Processing ${f##*/}"
sleep 3
# cat $f
done