Вы можете значительно упростить ситуацию, используя команду stat
вместо ls
.
#!/bin/bash
for i in $(find . -type f -mtime +10 );
do
echo "$i"
echo "ligne dans la boucle";
#il faut verifier si il a ete créer un samedi ou pas;
#///////////////////////
#jour=`ls -lrt $i| awk '{print $7}'`;
#mois=`ls -lrt $i| awk '{print $6}'`;
#annee=`ls -lrt $i| awk '{print $8}'`;
#requette="date -d '$mois $jour $annee' +'%a %u %A'";
#//////////////////////////////
# get the month, year, and day from stat-ing the file
mois_jour_annee=`stat -c '%y' "$i" | cut -d' ' -f1`
# and then...
requette="date -d '${mois_jour_annee}' +'%a %u %A'";
echo "$requette";
test=$(eval "$requette");
echo "$test";
echo " ";
done