LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   zenity radiolist parameters in variables (https://www.linuxquestions.org/questions/linux-newbie-8/zenity-radiolist-parameters-in-variables-4175540676/)

honest_abe 04-24-2015 09:48 PM

zenity radiolist parameters in variables
 
Note: Ubuntu 14 latest release

I am a highly experienced unix user with many years of experience. However, I retired 13 years ago so I can't remember some simple things so forgive me for posting here.

I am trying to use the "zenity --list --radiolist" command. Now this requires that the list of items be last and be of the form
FALSE <item name>
as in
FALSE "Choice 1" FALSE "Choice 2"
That's easy without variables. It would be
zenity --list --radiolist [other options here] FALSE "Choice 1" FALSE "Choice 2
Works fine.

But what I have is a list of choices in an array. Each of these is a string of multiple words and I have tried (nearly?) everything using echo command piped into zenity (supposed to work) to including an array element in the line with all sorts of quotes, single quotes, escaping quotes, etc. I have even included the "FALSE" in the variable so as not to have to generate it. Nothing works. When using the set -x, it shows that the shell has put a single quote around each word which makes each word a separate parameter.

I have searched all sorts of examples of zenity but the requirement for the word "FALSE" between each item while using variables is never shown.

If anyone has a working example of something like this (or any simple alternative:
JTemp[3]="This is a string"
echo "FALSE "${Jtemp[3]} | zenity --list --radiolist --text "Select Topic" --column "Topic" --column "Pick one"
which should display a radiobox with one entry, I would appreciate it. I could then expand it to include all the array elements.

I know I am doing something simple wrong. I just can't figure it out.

Note that I am writing this on a windows machine and using a non-internet-connected linux machine for my work so if I typed the command line wrong, it may be a problem here and not on the real machine.

Thanks for any help.

honest_abe 04-25-2015 09:39 AM

Fixed
 
I found that by using two echo command, one for the "FALSE" and one for the string and piping it to zenity resolves the problem.


All times are GMT -5. The time now is 05:37 AM.