Reputation: 1803
I got lost with getting return values for a bash dialog. The problem is: how to get return values of a --checklist ? It's a multiple choice list, where I need a return value of every item. Here is the code:
dialog --checklist "package timing" 20 75 5 \
"Package A" "3 s, 4 MB" on \
"Package B" "4 s, 2 MB" on \
"Package C" "1 s, 5 MB" on \
"Package D" "4 s, 2 MB" on \
"Package E" "Very Fast" off
retval=$?
CHOICE_PACKAGES=$RETVAL
First I thought, an array will be the return value. Apparently it isn't so. Does anybody know how to get all the return values of every item ?
[Post-Edit:] Maybe in this case, if someone has a good link about a complete Bash-Tutorial, I would appreciate that too.
Upvotes: 0
Views: 6305
Reputation: 4015
http://invisible-island.net/dialog/manpage/dialog.txt
says that
On exit, a list of the tag strings of those entries that are turned on will be printed on dialog's output.
So you can save the output to a temporary file
dialog <....> 2> tempfile
and then parse the contents of tempfile
. Your example will contain something like
"Package A" "Package B" "Package D"
Upvotes: 3