14 ms·
You're splitting the option value for -drive into multiple arguments. Here's an idea to fix that while keeping the same style: qemu-system-x86_64 \ -di
by jolmg 8y ago
You're splitting the option value for -drive into multiple arguments. Here's an idea to fix that while keeping the same style:
qemu-system-x86_64 \
-display none \
-m 2048 \
-serial stdio \
-drive "$(printf "%s"
file=/export/cirros.qcow2, \
format=qcow2, \
if=virtio
)"
- deleted 8y ago[deleted]
- yrro 8y agoIf you don't mind using bash: args=( -display none -m 2048 -serial stdio # -disabled-option ) qemu-system-x86_64 "${args[@]}" The array syntax means you can ditch the tedious backslashes and easily comment individual lines.
- deleted 8y ago[deleted]
- kashyapc 8y agoAh, indeed. Thanks for the nice trick to avoid the tedium.
- jolmg 8y agoYou're right about the ability to comment, but it doesn't save you from the tedious commas: drive_args=( file=/export/cirros.qcow2, format=qcow2, if=virtio ) qemu_args=( -display none -m 2048 -serial stdio -drive "$(printf "%s" "${drive_args[@]}")" ) qemu-system-x86_64 "${qemu_args[@]}" Personally, I prefer it with the backslashes if I don't need to comment.