gtkdialog again, the other way around this time – how to use bash variables in dialog?
Nils Kassube
kassube at gmx.net
Sun Apr 21 12:54:42 UTC 2013
Johnny Rosenberg wrote:
> > 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
[...]
> > <input file>$InstrumentsList</input>
[...]
> > <input file>$MusiciansList</input>
> > Now, in the script, I have the following lines:
> > export MainDialog=$(<${DialogFolder}/musician-dialogue.xml)
> > gtkdialog --program MainDialog
> > 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.
It doesn't work like this, no matter what quotes you use. The assignment
reads the contents of the file without variable expansion. But you could
replace the variables afterwards like this (untested):
MainDialog=$(<${DialogFolder}/musician-dialogue.xml)
MainDialog="${MainDialog/\$InstrumentsList/$InstrumentsList}"
MainDialog="${MainDialog/\$MusiciansList/$MusiciansList}"
export MainDialog
Nils
More information about the ubuntu-users
mailing list