1

I'm writing a script using zenity. But zenity 3.4.0 has a bug (has been fixed in latest Ubuntu versions), it returns exit code 139 instead of 0 or 1. But I need to use it in scenarios where the bug is still there.

So the solution is to bundle a custom zenity executable. But how can I override the zenity command with my custom one in the script?

ish
  • 139,926
satya164
  • 277
  • "Bundle" how? How is the script going to be installed, and on where? You may have to statically link (compile) the version of Zenity you need or there may be library issues if you simply include the binary in your bundle. – ish Jul 08 '12 at 02:05

2 Answers2

1

To use the custom zenity executable instead of the system default, we can place it in a directory and add the directory to the PATH.

Say I placed the executable in a directory $bindir.

Then I can add $bindir to the PATH variable.

export PATH="$bindir:$PATH"

Note that we need to add $bindir before $PATH, else it won't override the system executable. Because in PATH, the executable coming before is given more priority.

satya164
  • 277
0

Call it with the full path such as

/opt/myapp/bin/zenity

if your version of zenity is installed in /opt/myapp/bin/.

You may want to use a variable for this, for example

ZENITY=/opt/myapp/bin/zenity
...
$ZENITY --question --text 'Reboot universe?'