I wrote a script (kind of a learning thing) to open .rar archived files using unrar (non-free) in Linux. Now I want to add a section where my script will check to see if unrar is installed. To complicate matters, Linux also has a package 'unrar-free', and both use the name 'unrar' (therefore are incompatible with each other). So now, I not only need to see if 'unrar' is installed, I need to make sure it's the non-free version .
How would I check for a simple dependency at run-time?