Help with making the output of a command a variable

I'm writing a script that goes something like this:

#!/bin/bash

zenity --list --checklist --title="Choose Packages to Install" --width="1000" --height="400" \
--column="Select" --column="Package Name" --column="Description" \
GIMP=$( " " GIMP "GIMP is a free and open source photo editor."  \ )
if [ $GIMP == "GIMP" ]
then 
	sudo apt-get install $GIMP
fi

I want to open a dialog box with check boxes, package names, and descriptions. The box I have written is the first attached file.

I plan on adding other programs, but I have not gotten there yet.

The

" "

in the line

" " GIMP "Known as GIMP, GNU Image Manipulation Program is a free and open source photo editor." \

is for the first checkbox.

My main problem is the quotation marks at the end and beginning of the line (attached file #2). The quotation marks read in the wrong direction, and not how I want them to, having quotation marks inside of quotation marks?

Is there any way to fix this? Do I need to take a completely different approach?

I am not a fan of zenity , but I don't think zenity or double-quotes are your problem here.

The $( in your bash script starts a command substitution. That command substitution tries to run the command named by the first argument in the command substitution (in this case, a command named by the double-quoted <space> character that you say is intended to give you a check box). I would expect that to give you an error something like:

bash:  : command not found

but you won't get that until you finish the command substitution. Your command substitution is looking for an unescaped closing parenthesis to finish it. Since you have a backslash character escaping the closing parenthesis in your command substitution, another closing parenthesis is needed to close the command substitution!

Why are you trying to use a command substitution here? What command are you trying to run in this command substitution?

1 Like