
+while true +do + [ $# -eq 0 ] && break + case "$1" in + -h|--help) + help + shift;; + -d|--debug) + export DEBUG=true + shift;; + *) + echo "[ERROR] Unknown param: $1" + help + exit 1;; + esac
perhaps above "shift" operation should locate here, not every "case" parts.
Good, you're right. -------- Thanks Yu Chuan
Thanks, Liushaofei
+done + [[ $tbox_group ]] || tbox_group=vm-2p8g export hostname=$tbox_group.$USER-$$ diff --git a/providers/qemu/kvm.sh b/providers/qemu/kvm.sh index f1d65272dbf9..a3cbe4248a3a 100755 --- a/providers/qemu/kvm.sh +++ b/providers/qemu/kvm.sh @@ -123,7 +123,7 @@ print_message() echo kernel: $kernel echo initrds: $initrds echo append: $append - echo less $log_file + [ "$DEBUG" == "true" ] || echo less $log_file
sleep 5 } @@ -140,9 +140,10 @@ public_option() -k en-us -no-reboot -nographic - -serial file:${log_file} -monitor null ) + + [ "$DEBUG" == "true" ] || kvm=("${kvm[@]}" -serial file:${log_file}) }
individual_option() diff --git a/providers/qemu/pxe.sh b/providers/qemu/pxe.sh index fa688331964a..2e205405c793 100755 --- a/providers/qemu/pxe.sh +++ b/providers/qemu/pxe.sh @@ -18,7 +18,7 @@ fi qemu=qemu-system-aarch64 command -v $qemu >/dev/null || qemu=qemu-kvm
-echo less $serial_log +[ "$DEBUG" == "true" ] || echo less $serial_log
kvm=( $qemu @@ -33,7 +33,9 @@ kvm=( -k en-us -no-reboot -nographic - -serial file:${serial_log} -monitor null ) + +[ "$DEBUG" == "true" ] || kvm=("${kvm[@]}" -serial file:${serial_log}) + "${kvm[@]}" -- 2.23.0