Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-24-2015, 10:48 PM   #1
LQ Newbie
Registered: Apr 2015
Posts: 15

Rep: Reputation: Disabled
Question 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.
Old 04-25-2015, 10:39 AM   #2
LQ Newbie
Registered: Apr 2015
Posts: 15

Original Poster
Rep: Reputation: Disabled

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to take parameters in array variables and search for a pattern? RanjanR Programming 2 01-06-2012 06:29 AM
lockout parameters /variables andy curran Linux - Security 1 04-28-2011 12:49 PM
Is it possible to use variables to define Xdialog parameters in Bash script? Jude Terror Programming 2 01-22-2009 02:10 PM
Scripting Question - multiple {parameters} and variables gchilders Linux - Newbie 3 10-08-2008 09:31 AM
Zenity Checkbox extracting Variables webaccounts Linux - Newbie 5 09-18-2008 01:09 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:00 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration