bash script - dialog

I am writing a quite complex (for me) interface using dialog.
I was wondering if anyone can provide a solution for the following situation:
Instead of creating a fix list of items in a menu like this:

dialog --title "bla" --menu "bla2 " 11 60 4 \
   "1" "selection 1" \
   "2" "selection 2" \
   "3" "selection 3 \
   "4" "Exit" 2>/tmp/x

I need a VARIABLE list of items
Of course, the dimension of the dialog box can be automatically resized using 0 0 0 as dimension, however I see no solution to getting menu entries from a loop.

It should look like:
dialog --title "bla" --menu "bla2 " 0 0 0 \
for i in 1 2 3 4 5
   "$i" "selection $i" \
 "E" "Exit" 2>/tmp/x
Since there's no way AFAIK to introduce a for/while loop inside the dialog body, I'm looking for an alternative.

Anyone can give one?
Thank you
LVL 14
Adrian DobrotaNetworking EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


echo -n > test.rc
for i in 1 2 3 4 5; do echo \"$i\" \"selection $i\" >> test.rc; done
echo \"E\" \"Exit\" >> test.rc

dialog --title "bla" --menu "bla2 " 11 60 4 --file test.rc

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Adrian DobrotaNetworking EngineerAuthor Commented:
Thank you, exactly what I was looking for.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.