#!/bin/bash

function cleanup
{
# delai de reflexion
echo ' Delai de reflexion de 10 secondes '
sleep 10

# bon ben alors allons-y 
echo ' Debut du nettoyage'

for fic in \*~ \#* \*.pyc \*.py0 \.*.swp semantic.cache
do
    find $PREFIX -name  $fic -print -exec  \rm {}   \; 
done

#cd $PREFIX/doc ; make distclean

echo ' Fin du nettoyage'
}

PREFIX=`pwd`
PREFIX=$PREFIX/..
echo 
echo ' Elimination de *~ #* *.pyc dans ' "$PREFIX" 
echo ' Nettoyage du repertoire doc'
echo 


# test
while true
do
    echo " Nettoyage ? [y/n] "
    read answer
    answer=${answer:="n"}
    case $answer in
    n|N )
        echo ' Stop (pas de nettoyage)...'
        exit 0
	;;
    y|Y )
        cleanup
        exit 0
	;;
    esac
    echo " SVP, entrer y ou n pour quitter."
done


syntax highlighted by Code2HTML, v. 0.9.1