I'm having issue to use a variable inside cat command inside a .sh, it's not using it and I don't understand why !
I want to count lignes inside multiple file with the same name exept for the date for the sevens past days:
something_exemple_20211015_somethingelse.txt something_exemple_20211014_somethingelse.txt ...
I wrote this :
#!/bin/bash
for i in {1..7}; do
#Get the date of the seven days before inside dday var
dday=date +%Y%m%d -d ''"$i"' days ago'
number_ligne=0
#Count the number of line
number_ligne=cat /home/me/*exemple_*$dday* | wc -l
echo $dday
echo $number_ligne
done
The output looks like it's now using dday and doing this :
cat /home/me/*exemple_**
Do you have any idea
Thanks you !