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
if [ "$2" == "start" ]
then
echo "starting VM $1"
START
elif [ "$2" == "start-backup" ]
then
echo "starting VM rescue"
START_BACKUP
elif [ "$2" == "backup" ]
then
echo "backup VM"
BACKUP
elif [ "$2" == "restore" ]
then
echo "restore VM"
RESTORE
elif [ "$2" == "create" ]
then
echo "creating VM"
if [ $# -ge 3 ]
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.
CREATE "$3" # TODO
else
echo "$#"
echo "Error, no image defined." >&2
fi
elif [ "$2" == "suppr" ]
then
echo "suppressing all data of the vm $1"
SUPPRESS "$1"
else
echo "commande $2 inconnue" >&2
HELP
fi
case "$2" in
"start")
echo "starting VM $1"
START
;;
"start-backup")
echo "starting VM rescue"
START_BACKUP
;;
"backup")
echo "backup VM"
BACKUP
;;
"restore")
echo "restore backup"
RESTORE
;;
"create")
echo "creating VM"
if [ $# -ge 3 ]
then
echo "using image disk $3"
CREATE "$3"
else
echo "$#"
echo "Error, no image defined." >&2
fi
;;
"suppr")
echo "suppressing all data of the vm $1"
SUPPRESS "$1"
;;
"*")
echo "commande $2 inconnue" >&2
HELP
esac