This bash script is a text user interface (TUI) for managing virtual machines (VMs) using Oracle's VirtualBox software. The script uses a series of functions to present a list of options to the user and perform actions on VMs based on the user's selection.
The main_header
function displays the title of the TUI, and the vm_header
function shows information about the selected VM, including its current state. The separator_header
function outputs a separator line to visually break up the output.
The list_vms
function is the entry point for the script. It displays a list of available VMs for the user to choose from, or a message if no VMs are found. The selected VM's UUID is extracted from the list and passed to the stat_vm
function.
The stat_vm
function shows information about the selected VM and calls the list_actions
function, which presents a list of actions that can be performed on the selected VM. Depending on the user's selection, the script will call other functions to handle the specific action. For example, if the user selects "Start", the list_start_options
function is called to provide options for how the VM should be started.
The script also includes functions for pausing and resuming a VM, rebooting a VM, stopping a VM, and managing a VM's settings. When an action is completed, the script returns to the list_vms
function to allow the user to select another VM or perform another action.