truncating longer strings

This commit is contained in:
juronja 2026-02-17 08:12:52 +00:00
parent fdbd2d145a
commit 18b70e7c39

View File

@ -560,7 +560,11 @@ if [ "$IMPORT_DISKS" == "yes" ]; then
SCSI_NR=0
while read -r LSOUTPUT; do
DISKARRAY+=("$LSOUTPUT" "" "OFF")
TRUNCATED="${LSOUTPUT:0:50}"
if [ ${#LSOUTPUT} -gt 50 ]; then
TRUNCATED="${TRUNCATED}..."
fi
DISKARRAY+=("$LSOUTPUT" "$TRUNCATED" "OFF")
done < <(ls /dev/disk/by-id | grep -E '^ata-|^nvme-|^usb-' | grep -v 'part')
SELECTIONS=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "SELECT DISKS TO IMPORT" --checklist "\nSelect disk IDs to import. (Use Spacebar to select)\n" --cancel-button "Exit Script" 20 58 10 "${DISKARRAY[@]}" 3>&1 1>&2 2>&3 | tr -d '"') || exit