I’ll sometimes do this as an explicit pre-flight check. If so, it’s either because:
I use this program deep in the code and I don’t want to have to unroll a bunch of state (or fail and leave a broken mess) if I get halfway through and then find a critical external program is missing.
I want to be unusually user-friendly for a Unix program. Seriously, sometimes the failure that results “naturally” is misleading and will leave the user (usually me) scratching their head and having to troubleshoot. I can save them (myself) a bunch of time if I simply tell them (me) what's wrong.
I agree there’s no point to checking for availability on the line before you try to run the program; you might as well just process the error from system or whatever.
In reply to Re^2: Check for another program availability
by Radiola
in thread Check for another program availability
by hrcerq
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |