correction tabulation

This commit is contained in:
alexander.dales@etu.u-bordeaux.fr 2021-09-26 16:21:23 +02:00
parent dc935ad24b
commit 8e6ee8d5d7

View file

@ -8,96 +8,95 @@ nb=0
#vérification fichier double
verif ()
{
if [ $1 = "BACKUP" ]; then
if [ $1 = "BACKUP" ]; then
while true; do
if [ -e "$scandir${1}/scan_${date}_$nb" ];then
((nb=$nb+1))
else
break;
fi
done
# /!\ ceci n'est pas un debug
echo ${scandir}${1}/scan_${date}_$nb
else
while true; do
if [ -e "$scandir${1}/scan_${date}_$nb" ];then
((nb=$nb+1))
else
break;
fi
if [ -e "$ecole${1}/scan_${date}_$nb" ];then
((nb=$nb+1))
else
break;
fi
done
# /!\ ceci n'est pas un debug
echo ${scandir}${1}/scan_${date}_$nb
else
while true; do
if [ -e "$ecole${1}/scan_${date}_$nb" ];then
((nb=$nb+1))
else
break;
fi
done
# /!\ ceci n'est pas un debug
echo $ecole${1}/scan_${date}_$nb
fi
# /!\ ceci n'est pas un debug
echo $ecole${1}/scan_${date}_$nb
fi
}
#scan nouveau fichier
scan ()
{
while true; do
sleep 2
#ls que les noms puis for mais avec un while
ls -1 /home/oscar/scan-souris | while read -r file; do
echo $?
nb=0
echo $file
#ne prends pas en compte le dossier backup
if [ $file != "BACKUP" ]; then
#liste les process de l'utilisateur puis ne garde que 2 colonne d'information relative à la commande
ps -u | tr -s " " | cut -d " " -f 11,12 | while read -r process; do
case $process in
*"maths"*)
echo "math"
path=$( verif MATHS )
cp $scandir$file $path
echo "$?"
echo "$path"
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "$pathb"
echo "fichier transvasé dans MATHS"
;;
while true; do
sleep 2
#ls que les noms puis for mais avec un while
ls -1 /home/oscar/scan-souris | while read -r file; do
echo $?
nb=0
echo $file
#ne prends pas en compte le dossier backup
if [ $file != "BACKUP" ]; then
#liste les process de l'utilisateur puis ne garde que 2 colonne d'information relative à la commande
ps -u | tr -s " " | cut -d " " -f 11,12 | while read -r process; done
case $process in
*"maths"*)
path=$( verif MATHS )
cp $scandir$file $path
#echo "$?"
#echo "$path"
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "$pathb"
echo "fichier transvasé dans MATHS"
;;
*"français"*)
path=$( verif FRANCAIS )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans FRANCAIS"
;;
path=$( verif FRANCAIS )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans FRANCAIS"
;;
*"poésie"*)
path=$( verif POESIE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans POESIE"
;;
path=$( verif POESIE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans POESIE"
;;
*"histoire"*)
path=$( verif HISTOIRE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans HISTOIRE"
;;
*"ergothérapeute"*)
path=$( verif ERGOTHÉRAPEUTE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans ERGOTHERAPEUTE"
;;
path=$( verif HISTOIRE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans HISTOIRE"
;;
*"ergothérapeute"*)
path=$( verif ERGOTHÉRAPEUTE )
cp $scandir$file $path
pathb=$( verif BACKUP )
mv $scandir$file $pathb
echo "fichier transvasé dans ERGOTHERAPEUTE"
;;
# *)
# pathb=$( verif BACKUP )
#mv $scandir$file $pathb
#echo "Aucune matière active, fichier placé à : $pathb"
# ;;
esac
done
fi
done
#echo "sortie while"
done
#mv $scandir$file $pathb
#echo "Aucune matière active, fichier placé à : $pathb"
# ;;
esac
done
fi
done
#echo "sortie while"
done
}
scan