2022-02-09 10:33:18 +01:00

27 lines
464 B
Bash
Executable File

#!/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