#!/bin/bash if [[ -z $* ]]; then zenity --info --title="Script suppression fichier" --text="Syntaxe exacte: $0 Nom_du_fichier" else for fichier in $* do #test l'existance du fichier if [ -e $fichier ]; then # Boucle de confirmation de l'effacement du fichier ok=$(zenity --entry --title="Script suppression fichier" --text="Etes vous sur de vouloir effacer $fichier (oui/non)?") while [ "$ok" != "oui" ] && [ "$ok" != "non" ] && [ "$ok" != "" ] do ok=$(zenity --entry --title="Script suppression fichier" --text="veillez taper oui pour confirmé non pour annulé ." --entry-text="oui ou non") done #Si ok est strictement = à oui on efface sinon il y a uune erreur if [ "$ok" == "oui" ]; then rm -rf $fichier zenity --info --title="Script suppression fichier" --text="$fichier vient d'ètre effacé" else zenity --info --title="Script suppression fichier" --text="$fichier n'a pas été effacé" fi else zenity --info --title="Script suppression fichier" --text="$fichier n'existe pas" fi done fi