Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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?'
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
add comment

Your Answer

 
discard

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.