Jeudi 26 novembre 2009
4
26
/11
/Nov
/2009
13:12
Cette fois-ci, il nous a été demandé de creer une troisième colonne, DUMP TEXT:
Voici le script:
#!/bin/bash
echo "Pour analyser des fichiers dans un répertoire, saisir un chemin S.V.P: ";
read dossier;
echo "Répertoire lu et donne le chemin où tu veux créer la page :";
read tablo;
echo "Tableau créé";
echo "<html><head><title>Tableau des liens</title></head>" > $tablo;
echo "<body style=\"background-color: #CC3366;\"><center><p align=\"justify\"><font style=\"font-family:arial;\" color=\"orange\" ><h1>Voici le tableau des
liens</h1></font></p><table border=\"1\" bgcolor=\"silver\" width=\"30%\">" > $tablo;
i=1
for fichier in `ls $dossier`
{
y=1;
echo "<thead><tr><th>Fichier $fichier</th><th>PAGES-ASPIREES</th><th>DUMP TEXT</th></tr></thead>">> $tablo;
for nom in `cat $dossier/$fichier`
{
wget -O ./PAGES-ASPIREES/$i.html $nom
lynx -dump $nom > ./DUMP-TEXT/$i.txt
echo "<tr><td><a href=\"$nom\">$nom</a></td><td><a href=\"../PAGES-ASPIREES/$i.html\">PAGE
ASPIREE</a></td><td><a href=\"../DUMP-TEXT/$i.txt\">PAGE DUMP</a></td></tr>" >> $tablo;
let "i+=1" ;
let "y+=1" ;
}
}
echo "</table></body></html>" >> $tablo;