#!/usr/bin/env bash main() { while getopts ":l:d:t:" opt; do case "${opt}" in l) unset VM_FILTER IFS="," read -r -a VM_FILTER <<< "$OPTARG" ;; d) local backup_location="${OPTARG}" backup_location="${backup_location%/}" ;; t) declare -g TARGET="$OPTARG" ;; h) usage ;; *) usage ;; esac done backup_location=${backup_location:-$PWD} if [[ "${#VM_FILTER[*]}" -gt 0 ]]; then backup_vms "$backup_location" "${VM_FILTER[@]}" else backup_vms "$backup_location" fi } lxc() { local lxc_cmd="${TARGET:-lxc}" command "$lxc_cmd" "$@" } list_vms() { lxc list -c n -f csv,noheader } usage() { cat <