#!/bin/bash REVISION_DAY=`date '+%d'` REVISION_MONTH=`date '+%B'` REVISION_YEAR=`date '+%Y'` HOST_NAME="manpagesfr.free.fr" MANDIR="man" if [ $REVISION_DAY == "01" ] then REVISION_DAY_STRING=1er elif [ $REVISION_DAY == "02" ] then REVISION_DAY_STRING=2 elif [ $REVISION_DAY == "03" ] then REVISION_DAY_STRING=3 elif [ $REVISION_DAY == "04" ] then REVISION_DAY_STRING=4 elif [ $REVISION_DAY == "05" ] then REVISION_DAY_STRING=5 elif [ $REVISION_DAY == "06" ] then REVISION_DAY_STRING=6 elif [ $REVISION_DAY == "07" ] then REVISION_DAY_STRING=7 elif [ $REVISION_DAY == "08" ] then REVISION_DAY_STRING=9 elif [ $REVISION_DAY == "09" ] then REVISION_DAY_STRING=9 else REVISION_DAY_STRING=$REVISION_DAY fi if [ ! -e "$1" ] then echo "Le fichier $1 n'existe pas" exit 1 fi # si c'est une page secondaire, if [[ $(grep ".so man" $1) ]] then # si la version html existe, l'effacer if [ -e "$1.html" ] then rm -rf $1.html fi # ajouter une redirection au fichier .htaccess cat $1 | sed -e " s|\.so \(man[[:digit:]]\)/\(.*\)|RedirectPermanent /$MANDIR/\1/$1\.html http://$HOST_NAME/$MANDIR/\1/\2.html| " \ >> .htaccess exit 0 fi # si la pge html existe déjà if [ -e "$1.html" ] then # et qu'elle est plus récente que la page de man if [ "$1" -ot "$1.html" ] then # alors on ne fait rien exit 0 fi fi cat $1 | \ sed "# supprime la ligne vierge précédant .SH s/^$\n\(\.SH.*$\)/\1/ " | \ man2html | sed -e " # supprime les lignes vides #/^$/d # supprime la ligne contenant Content-type: text /^Content-type: text\/html$/d # Traduction du nom de la page html s/
Dernière mise à jour : $REVISION_DAY_STRING $REVISION_MONTH $REVISION_YEAR<\/p>\n <\/div>/ /This document was created by/,/using the manual pages/{d} s/<\/HEAD>/ \n<\/head>/ # modif des liens entre pages manuel s|[[:alnum:]_-\.]*|\2<\/A>| # modif des liens vers l'index s|Return to Main Contents|Menu principal| # ajout de div page s/
/\n