change a if elif elif elif else by a case

This commit is contained in:
primardj 2024-01-23 21:19:36 +00:00
parent 6c1dadb06b
commit a9acae3ca3

View file

@ -240,39 +240,40 @@ then
fi fi
if [ "$2" == "start" ] case "$2" in
then "start")
echo "starting VM $1" echo "starting VM $1"
START START
elif [ "$2" == "start-backup" ] ;;
then "start-backup")
echo "starting VM rescue" echo "starting VM rescue"
START_BACKUP START_BACKUP
elif [ "$2" == "backup" ] ;;
then "backup")
echo "backup VM" echo "backup VM"
BACKUP BACKUP
elif [ "$2" == "restore" ] ;;
then "restore")
echo "restore VM" echo "restore backup"
RESTORE RESTORE
elif [ "$2" == "create" ] ;;
then "create")
echo "creating VM" echo "creating VM"
if [ $# -ge 3 ] if [ $# -ge 3 ]
then then
echo "using image disk $3" # Error here, please don't think that there will be only three devices, should be improve like with an install-device parametter. echo "using image disk $3"
CREATE "$3" # TODO CREATE "$3"
else else
echo "$#" echo "$#"
echo "Error, no image defined." >&2 echo "Error, no image defined." >&2
fi fi
elif [ "$2" == "suppr" ] ;;
then "suppr")
echo "suppressing all data of the vm $1" echo "suppressing all data of the vm $1"
SUPPRESS "$1" SUPPRESS "$1"
else ;;
echo "commande $2 inconnue" >&2 "*")
HELP echo "commande $2 inconnue" >&2
fi HELP
esac