From 83452dea578d0e05b4c78c93c6744b8e6b2b7560 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Thu, 25 Nov 2021 01:36:39 -0600 Subject: [PATCH] Moved to associative array --- Misc/Arch-LuksCrpy-Install.bash | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Misc/Arch-LuksCrpy-Install.bash b/Misc/Arch-LuksCrpy-Install.bash index 1ad5c12..a143389 100755 --- a/Misc/Arch-LuksCrpy-Install.bash +++ b/Misc/Arch-LuksCrpy-Install.bash @@ -1,5 +1,9 @@ #!/bin/bash -#!/bin/bash + +### GLOBALS ### +declare -A DISKS + +### GLOBALS ### echo_rgb() { # Echo a colored string to the terminal based on rgb values @@ -124,13 +128,18 @@ get_available_disks() { done <<< "$(lsblk)" - local ret_val # Build the array into a string, yes this is less efficient, but easier to modify in the future if something changes + local disk_num + disk_num=0 for disk in "${available_disks[@]}"; do + DISKS["${disk_num}"]+="${disk}" ret_val="${ret_val} ${disk}" done - echo "${ret_val}" +} + +choose_disk() { + } install() { @@ -141,8 +150,8 @@ install() { available_disks="$(get_available_disks)" log "info" "Available disks: " - for disk in ${available_disks}; do - echo " - $(important "${disk}")" + for disk in "${!DISKS[@]}"; do + echo " - $(important "${DISKS[disk]}")" done }