I need to create a dynamic menu with dialog using vars from an array.
Heres my code:
#!/bin/bash
file="teste.cfg"
count=0;
while IFS=";" read nomeTarefa dirOrigem dirDest tipoBkp agendarBkp compactarBkp gerarLog || [[ -n "$gerarLog" ]]; do #RECEBE NAS VARS OS VALORES DELIMITADOS POR ;
count=$((count + 1));#INICIA O COUNT PARA INCREMENTAR O OPTIONS
options[$count]="$options$count) \"$nomeTarefa\"" #CONCATENA O OPTIONS
done < $file
options=$"$options"
for ((i=1; i<=count; i++))
do
echo ${options[$i]}
done
options=(${options[$count]})
cmd=(dialog --keep-tite --menu "Select options:" 22 76 16)
choices=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
I recieve vars from a file, and then i need to build the "options" dynamicly to create a case.
So this menu dialog, will have x numbers of entries and when i run any of them i do something.
Any ideas how can i build this "options"?
Thanks in advance