#!/bin/bash HOST=root@onfarbo43 restore () { ssh "${HOST}" "mysql -u ap45 -pAzerty1+ bdarbre" < bdarbre43.sql } while getopts "f" OPT do case "${OPT}" in f) restore exit 0; ;; esac done confirm() { read -r -n 1 -p "${1:-Confirmer?} [o/n]: " REPLY case $REPLY in [oO]) echo ; restore ;; [nN]) echo ; exit 1 ;; *) printf " \033[31m %s \n\033[0m" "Entrée non valide" esac } confirm exit 0