Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
"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. – izx Jul 8 '12 at 2:05

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.

share|improve this answer

Call it with the full path such as


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

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

$ZENITY --question --text 'Reboot universe?'
share|improve this answer
The problem is that I didn't want to replace all instances of zenity in my script. – satya164 Jul 8 '12 at 11:17
You can still call the old version of zenity by running just zenity – Florian Diesch Jul 8 '12 at 14:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.