shell syntax optimized and more options for rebase-vm.sh

This commit is contained in:
Raphael Dannecker 2023-02-12 14:38:29 +01:00
parent c1ff7319f4
commit 354075f530
7 changed files with 79 additions and 40 deletions

View file

@ -3,9 +3,8 @@
set -eu
# if less than one arguments supplied, display usage
if [ "$#" -ne 1 ]
then
# if less or more than one arguments supplied, display usage
if [[ $# -ne 1 ]]; then
echo "This script takes as input the name of the VM to clone"
echo "Usage: $0 vm_name"
exit 1
@ -16,7 +15,7 @@ cd /var/lib/libvirt/images
VM_NAME=$1
if [ ! -f "xml/${VM_NAME}.xml" -a -f "${VM_NAME}.gcow2" ]; then
if [[ ! -f "xml/${VM_NAME}.xml" ]] || [[ ! -f "${VM_NAME}.gcow2" ]]; then
echo "xml or qcow2 File does not exists."
exit 1
fi