#!/bin/bash exec_as() { local user="$1" shift if [ "$(whoami)" != "$user" ]; then exec sudo -u "$user" "$0" "$@" else cd || return fi } exec_as qemu "$@" || exit PATH="./bin:${PATH}" perror() { >&2 printf '\033[1;31mERROR:\033[0m \033[1m%s\033[0m\n' "$*" } public_help() { local name name="$(basename "$0")" cat << EOF ${name}: usage: ${name} active - (default behaviour) list active VMs ${name} start - start a VM ${name} watch - attach VM screen session ${name} ls - list available VMs ${name} add