I have an script that will show some compress options to the user (gzip, zip, and bzip). Since this is meant to run on both Linux & Windows and the Zlib library won't be available I have to compress any files by using Unix commands. Of course, if the script runs on Windows it probably won't have any of the nice command line compress tools, and thus the app should not show any choices to the user.
So, what I want to know is how to check whether the command line tool exists. I could just check whether the executable file exists, but it's not reliable at all (for instance, on my desktop I use Gentoo Linux and the zip
command lives on /usr/bin
; on the other hand, on my server it lives on /bin
).