Re: gtkdialog again, the other way around this time – how to use bash variables in dialog?
Johnny Rosenberg
gurus.knugum at gmail.com
Sun Apr 21 08:52:26 UTC 2013
2013/4/21 Nils Kassube <kassube at gmx.net>:
> Johnny Rosenberg wrote:
>> Here is some nonsense code that I'm trying to make work:
> [...]
>> export MainDialog='
> [...]
>> <input file>$InstrumentsList</input>
> [...]
>> <input file>$MusiciansList</input>
> [...]
>> </vbox>'
>> gtkdialog --program MainDialog
>
>> The problem is that $InstrumentsList and $MusiciansList doesn't
>> expand, and whatever I tried I failed.
>
> You used single quotes [1] instead of double quotes [2] for the
> MainDialog declaration.
>
>
> Nils
>
> [1] <http://www.gnu.org/software/bash/manual/html_node/Single-Quotes.html>
> [2] <http://www.gnu.org/software/bash/manual/html_node/Double-Quotes.html>
Thanks, I don't know why I didn't change that, because I know the
difference. I guess I just didn't think…
Anyway, so far, so good, but the next step is to keep the dialogue in
a separate file, like this (file name stored in
${DialogFolder}/musician-dialogue.xml – I know it's not a real xml,
but I call it that to make gedit view tags and data in different
colours – better ideas are appreciated):
<vbox>
<hbox>
<text>
<label>Instrument:</label>
</text>
<comboboxentry>
<default>Välj musikinstrument</default>
<variable>Instrument</variable>
<input file>$InstrumentsList</input>
</comboboxentry>
<text>
<label>Utövare:</label>
</text>
<comboboxentry>
<default>Välj utövare</default>
<variable>Musician</variable>
<input file>$MusiciansList</input>
</comboboxentry>
</hbox>
<hbox>
<button ok></button>
<button cancel></button>
</hbox>
</vbox>
Now, in the script, I have the following lines:
# Code starts here
-------------------------------------------------------------------
#!/bin/bash
RosenTagDir="${HOME}/bin/RosenTagg"
InstrumentsList="${RosenTagDir}/Lists/Instruments"
MusiciansList="${RosenTagDir}/Lists/Musicians"
DialogFolder="${RosenTagDir}/Dialogues"
export MainDialog=$(<${DialogFolder}/musician-dialogue.xml)
gtkdialog --program MainDialog
# End of code -------------------------------------------------------------------------
Now I end up with the same problem again; the Bash variables do not expand.
I tried a few different combinations of double quotes on the export
MainDialog=$(<${DialogFolder}/musician-dialogue.xml) line with no
luck.
Well, at least it works now, but it would be so nice if I could have a
separate file for the dialogue.
Thanks!
Johnny Rosenberg
More information about the ubuntu-users
mailing list