From 90f3addf180508fe4afc396f2584763e4212dfa1 Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Mon, 28 Feb 2011 17:54:08 +0100 Subject: [PATCH] =?UTF-8?q?[ERR]=20Fichiers=20sur=20les=20cat=C3=A9gories?= =?UTF-8?q?=20(en=20cours=20de=20d=C3=A9veloppement)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composants/categ_deb.html | 5 +++++ composants/{categ.html => categ_exemple.html} | 0 composants/categ_fin.html | 2 ++ parcours_categ.sh | 19 +++++++++++++++++-- 4 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 composants/categ_deb.html rename composants/{categ.html => categ_exemple.html} (100%) create mode 100644 composants/categ_fin.html diff --git a/composants/categ_deb.html b/composants/categ_deb.html new file mode 100644 index 0000000..e6a565d --- /dev/null +++ b/composants/categ_deb.html @@ -0,0 +1,5 @@ + + +

@@TITRE_CATEG@@

+

@@DESC_CATEG@@

+
diff --git a/composants/categ.html b/composants/categ_exemple.html similarity index 100% rename from composants/categ.html rename to composants/categ_exemple.html diff --git a/composants/categ_fin.html b/composants/categ_fin.html new file mode 100644 index 0000000..6c94176 --- /dev/null +++ b/composants/categ_fin.html @@ -0,0 +1,2 @@ +
+
 
diff --git a/parcours_categ.sh b/parcours_categ.sh index 79840dd..db92e72 100755 --- a/parcours_categ.sh +++ b/parcours_categ.sh @@ -23,10 +23,17 @@ debug() { fi } +## TESTS +if ! test -d $dossier +then + echo -e "Dossier '$dossier' manquant." + exit 0 +fi + ## DEBUT # Parcours du dossier -#TODO: n'afficher que les fichiers dont l'extension est .txt -#+ À l'aide de find par exemple +#TODO: n'afficher que les fichiers dont l'extension est .txt (ou .ail?) +#+ À l'aide de find par exemple. for fichier in `ls $dossier` do # Calcul du nombre de ligne du fichier @@ -36,6 +43,14 @@ do # Vérification du nombre de lignes retourné if [[ $nbre_lignes -gt 0 ]] then + # Récupération du nom de la catégorie + nbre_categories=`grep "\[\[" ${dossier}/${fichier} |wc -l` + # Si le nombre de catégorie est égal à 1, on a tout bon + if [[ $nbre_categories -eq 0 ]] + then + echo "Fichier '${dossier}/${fichier}' mal renseigné : Pas de nom de catégorie" + else + echo "Fichier '${dossier}/${fichier}' mal renseigné : Trop de catégorie présentes." # le fichier contient plusieurs lignes, on lit le contenu for ligne in $(cat ${dossier}/${fichier}) do