and the -i file / --include=file is a very robust way of getting a slew of functions without having to use export -f (which is a bashism)thunor wrote: Reading from a file or stdin are both fine though and it'd be a good idea to stick to these methods for complex apps until everyone is using at least r308.
ex.
Code: Select all
#!/bin/sh
. /usr/local/myapp/myfunctions
#code
eval `gtkdialog --include=/usr/local/myapp/myfunctions --file=/usr/local/myapp/myMAIN`
#more code
I have found that commands in the shabang cannot end in a number (#!/usr/sbin/gtkdialog3 -e fails, but #!/usr/sbin/gtkdialog -e succeeds)
ex.
Code: Select all
#!/usr/sbin/gtkdialog -e
function print_this() {
echo "print: $1"
}
export MAIN_DIALOG='
<vbox>
<button>
<label>function</label>
<action>print_this button</action>
</button>
<button>
<label>Exit</label>
</button>
</vbox>
'